From f4abed909c548b58ee31fee1dea1f05e0f954462 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Sat, 9 Apr 2022 22:04:24 +0200 Subject: [PATCH] Fixup: password shall be sent to owner when password is to be given during a Talk session. Signed-off-by: Cyrille Bollu --- apps/sharebymail/lib/ShareByMailProvider.php | 5 +++-- apps/sharebymail/tests/ShareByMailProviderTest.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php index 62b885483c8f1..1e767b7f8596a 100644 --- a/apps/sharebymail/lib/ShareByMailProvider.php +++ b/apps/sharebymail/lib/ShareByMailProvider.php @@ -196,8 +196,9 @@ public function create(IShare $share) { $shareId = $this->createMailShare($share); - // Sends share password when it's a permanent one (otherwise guest will have to request it via the showShare UI) - if ($this->config->getSystemValue('allow_mail_share_permanent_password')) { + // Sends share password to receiver when it's a permanent one (otherwise she will have to request it via the showShare UI) + // or to owner when the password shall be given during a Talk session + if ($this->config->getSystemValue('allow_mail_share_permanent_password') || $share->getSendPasswordByTalk()) { $send = $this->sendPassword($share, $password); if ($passwordEnforced && $send === false) { $this->sendPasswordToOwner($share, $password); diff --git a/apps/sharebymail/tests/ShareByMailProviderTest.php b/apps/sharebymail/tests/ShareByMailProviderTest.php index cf891fecd65e5..b00ef13630fdd 100644 --- a/apps/sharebymail/tests/ShareByMailProviderTest.php +++ b/apps/sharebymail/tests/ShareByMailProviderTest.php @@ -453,7 +453,7 @@ public function testCreateSendPasswordByTalkWithEnforcedPasswordProtection() { // The autogenerated password should be mailed to the owner of the share. $this->shareManager->expects($this->any())->method('shareApiLinkEnforcePassword')->willReturn(true); - $this->config->expects($this->once())->method('getSystemValue')->with('allow_mail_share_permanent_password')->willReturn(true); + $this->config->expects($this->once())->method('getSystemValue')->with('allow_mail_share_permanent_password')->willReturn(false); $this->settingsManager->expects($this->any())->method('sendPasswordByMail')->willReturn(true); $instance->expects($this->once())->method('autoGeneratePassword')->with($share)->willReturn('autogeneratedPassword');