From 7a304fee6fb55ffc6d54050b3b59d84f8987e754 Mon Sep 17 00:00:00 2001 From: Semih Serhat Karakaya Date: Fri, 8 Nov 2019 21:33:04 +0300 Subject: [PATCH] allow resharer to send an e-mail for public link --- changelog/unreleased/36393 | 6 ++++++ lib/private/Share/MailNotifications.php | 2 +- .../reShareByPublicLink.feature | 17 ++++++----------- 3 files changed, 13 insertions(+), 12 deletions(-) create mode 100644 changelog/unreleased/36393 diff --git a/changelog/unreleased/36393 b/changelog/unreleased/36393 new file mode 100644 index 000000000000..de664b5c2fb5 --- /dev/null +++ b/changelog/unreleased/36393 @@ -0,0 +1,6 @@ +Bugfix: allow re-sharer to send an e-mail for public link + +Sending an e-mail when creating public links from received shares was impossible. This problem fixed. + +https://github.com/owncloud/core/issues/36386 +https://github.com/owncloud/core/pull/36393 diff --git a/lib/private/Share/MailNotifications.php b/lib/private/Share/MailNotifications.php index 03c05ab345a9..b5b7ac9a9856 100644 --- a/lib/private/Share/MailNotifications.php +++ b/lib/private/Share/MailNotifications.php @@ -229,7 +229,7 @@ public function sendLinkShareMail($sender, $recipients, $link, $personalNote = n $token = \array_pop($linkParts); try { $share = $this->shareManager->getShareByToken($token); - if ($share->getShareOwner() !== $currentUser) { + if ($share->getShareOwner() !== $currentUser && $share->getSharedBy() !== $currentUser) { return $recipients; } } catch (ShareNotFound $e) { diff --git a/tests/acceptance/features/webUISharingPublic/reShareByPublicLink.feature b/tests/acceptance/features/webUISharingPublic/reShareByPublicLink.feature index a0f4358bd31d..15aae72928ba 100644 --- a/tests/acceptance/features/webUISharingPublic/reShareByPublicLink.feature +++ b/tests/acceptance/features/webUISharingPublic/reShareByPublicLink.feature @@ -18,20 +18,15 @@ Feature: Reshare by public link And the public accesses the last created public link using the webUI Then file "lorem.txt" should be listed on the webUI - @issue-36386 Scenario: user shares a public link via email Given user "user1" has created folder "/simple-folder" And user "user1" has shared folder "/simple-folder" with user "user2" with permissions "share,read" And parameter "shareapi_allow_public_notification" of app "core" has been set to "yes" And user "user2" has logged in using the webUI - #When the user creates a new public link for folder "simple-folder" using the webUI with - When the user tries to create a new public link for folder "simple-folder" using the webUI with + When the user creates a new public link for folder "simple-folder" using the webUI with | email | foo@bar.co | - #Then the email address "foo@bar.co" should have received an email with the body containing - # """ - # User Two shared simple-folder with you - # """ - #And the email address "foo@bar.co" should have received an email containing the last shared public link - Then dialog should be displayed on the webUI - | title | content | - | An error occured while sending email | Couldn't send mail to following recipient(s): foo@bar.co | + Then the email address "foo@bar.co" should have received an email with the body containing + """ + User Two shared simple-folder with you + """ + And the email address "foo@bar.co" should have received an email containing the last shared public link