-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[stable10] Backport of Share notification recipients should be added …
…to list Share notification recipients should be added to list. Adding them to bcc was causing spam filters to block the emails. This change would solve the issue and users get notified. Signed-off-by: Sujith H <[email protected]>
- Loading branch information
Showing
3 changed files
with
78 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,7 +151,7 @@ public function testSendLinkShareMailWithRecipientAndOptions() { | |
->method('setSubject') | ||
->with('TestUser shared »MyFile« with you'); | ||
$message | ||
->expects($this->once()) | ||
->expects($this->exactly(2)) | ||
->method('setTo') | ||
->with(['[email protected]']); | ||
$message | ||
|
@@ -195,7 +195,7 @@ public function testSendLinkShareMailWithRecipientAndOptions() { | |
$calledEvent[] = 'share.sendmail'; | ||
$calledEvent[] = $event; | ||
}); | ||
$this->assertSame([], $mailNotifications->sendLinkShareMail('[email protected]', 'MyFile', 'https://owncloud.com/file/?foo=bar', 3600, "personal note\n", ['bcc' => '[email protected],[email protected]', 'cc' => '[email protected],[email protected]'])); | ||
$this->assertSame([], $mailNotifications->sendLinkShareMail('[email protected]', 'MyFile', 'https://owncloud.com/file/?foo=bar', 3600, "personal note\n", ['to' => '[email protected]', 'bcc' => '[email protected],[email protected]', 'cc' => '[email protected],[email protected]'])); | ||
|
||
$this->assertEquals('share.sendmail', $calledEvent[0]); | ||
$this->assertInstanceOf(GenericEvent::class, $calledEvent[1]); | ||
|
@@ -218,7 +218,7 @@ public function testSendLinkShareMailPersonalNote() { | |
->method('setSubject') | ||
->with('TestUser shared »MyFile« with you'); | ||
$message | ||
->expects($this->once()) | ||
->expects($this->exactly(2)) | ||
->method('setTo') | ||
->with(['[email protected]']); | ||
$message | ||
|
@@ -262,7 +262,7 @@ public function testSendLinkShareMailPersonalNote() { | |
$calledEvent[] = 'share.sendmail'; | ||
$calledEvent[] = $event; | ||
}); | ||
$this->assertSame([], $mailNotifications->sendLinkShareMail('[email protected]', 'MyFile', 'https://owncloud.com/file/?foo=bar', 3600, "personal note\n")); | ||
$this->assertSame([], $mailNotifications->sendLinkShareMail('[email protected]', 'MyFile', 'https://owncloud.com/file/?foo=bar', 3600, "personal note\n", ['to' => '[email protected]'])); | ||
|
||
$this->assertEquals('share.sendmail', $calledEvent[0]); | ||
$this->assertInstanceOf(GenericEvent::class, $calledEvent[1]); | ||
|
@@ -340,13 +340,13 @@ public function testSendLinkShareMailWithReplyTo($to, array $expectedTo) { | |
|
||
public function dataSendLinkShareMailException() { | ||
return [ | ||
['[email protected]', '', '', '[email protected]'], | ||
['[email protected]', '[email protected],[email protected]', '', '[email protected],[email protected],[email protected]'], | ||
['[email protected]', '', '[email protected],[email protected]', '[email protected],[email protected],[email protected]'], | ||
['[email protected]', '[email protected],[email protected]', '[email protected],[email protected]', '[email protected],[email protected],[email protected],[email protected],[email protected]'], | ||
['', '[email protected],[email protected]', '', '[email protected],[email protected]'], | ||
['', '', '[email protected],[email protected]', '[email protected],[email protected]'], | ||
['', '[email protected],[email protected]', '[email protected],[email protected]', '[email protected],[email protected],[email protected],[email protected]'], | ||
['[email protected]', '', '', '[email protected]', 'lukas@owncloud.com,abc@foo.com'], | ||
['[email protected]', '[email protected],[email protected]', '', '', '[email protected],[email protected],[email protected]'], | ||
['[email protected]', '', '[email protected],[email protected]', '', '[email protected],[email protected],[email protected]'], | ||
['[email protected]', '[email protected],[email protected]', '[email protected],[email protected]', '', '[email protected],[email protected],[email protected],[email protected],[email protected]'], | ||
['', '[email protected],[email protected]', '', '', '[email protected],[email protected]'], | ||
['', '', '[email protected],[email protected]', '', '[email protected],[email protected]'], | ||
['', '[email protected],[email protected]', '[email protected],[email protected]', '', '[email protected],[email protected],[email protected],[email protected]'], | ||
]; | ||
} | ||
|
||
|
@@ -357,7 +357,7 @@ public function dataSendLinkShareMailException() { | |
* @param string $bcc | ||
* @param string $expectedRecipientErrorList | ||
*/ | ||
public function testSendLinkShareMailException($to, $cc, $bcc, $expectedRecipientErrorList) { | ||
public function testSendLinkShareMailException($to, $cc, $bcc, $toList, $expectedRecipientErrorList) { | ||
$this->setupMailerMock('TestUser shared »MyFile« with you', [$to]); | ||
|
||
$mailNotifications = new MailNotifications( | ||
|
@@ -373,6 +373,10 @@ public function testSendLinkShareMailException($to, $cc, $bcc, $expectedRecipien | |
|
||
$options = []; | ||
|
||
if ($toList !== '') { | ||
$options['to'] = $toList; | ||
} | ||
|
||
if ($cc !== '') { | ||
$options['cc'] = $cc; | ||
} | ||
|
@@ -621,17 +625,17 @@ protected function setupMailerMock($subject, $to, $exceptionOnSend = true) { | |
->method('setSubject') | ||
->with($subject); | ||
$message | ||
->expects($this->once()) | ||
->expects($this->any()) | ||
->method('setTo') | ||
->with($to); | ||
$message | ||
->expects($this->once()) | ||
->method('setHtmlBody'); | ||
$message | ||
->expects($this->once()) | ||
->expects($this->any()) | ||
->method('setPlainBody'); | ||
$message | ||
->expects($this->once()) | ||
->expects($this->any()) | ||
->method('setFrom') | ||
->with([Util::getDefaultEmailAddress('sharing-noreply') => 'TestUser via UnitTestCloud']); | ||
|
||
|
@@ -641,7 +645,7 @@ protected function setupMailerMock($subject, $to, $exceptionOnSend = true) { | |
->will($this->returnValue($message)); | ||
if ($exceptionOnSend) { | ||
$this->mailer | ||
->expects($this->once()) | ||
->expects($this->any()) | ||
->method('send') | ||
->with($message) | ||
->will($this->throwException(new \Exception('Some Exception Message'))); | ||
|