[Pkg-owncloud-commits] [owncloud] 35/107: Allow sending a share email to multiple users

David Prévot taffit at moszumanska.debian.org
Thu Dec 17 19:40:34 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit 96be3a4a7d6995ccbae53d0d4597f1cb9e4fba2f
Author: Joas Schilling <nickvergessen at owncloud.com>
Date:   Mon Dec 7 10:49:34 2015 +0100

    Allow sending a share email to multiple users
---
 lib/private/share/mailnotifications.php   |  4 +++-
 tests/lib/share/MailNotificationsTest.php | 20 +++++++++++++++++---
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/lib/private/share/mailnotifications.php b/lib/private/share/mailnotifications.php
index 8056260..9119d15 100644
--- a/lib/private/share/mailnotifications.php
+++ b/lib/private/share/mailnotifications.php
@@ -180,10 +180,12 @@ class MailNotifications {
 		$subject = (string)$this->l->t('%s shared »%s« with you', [$this->senderDisplayName, $filename]);
 		list($htmlBody, $textBody) = $this->createMailBody($filename, $link, $expiration);
 
+		$recipient = str_replace([', ', '; ', ',', ';', ' '], ',', $recipient);
+		$recipients = explode(',', $recipient);
 		try {
 			$message = $this->mailer->createMessage();
 			$message->setSubject($subject);
-			$message->setTo([$recipient]);
+			$message->setTo($recipients);
 			$message->setHtmlBody($htmlBody);
 			$message->setPlainBody($textBody);
 			$message->setFrom([
diff --git a/tests/lib/share/MailNotificationsTest.php b/tests/lib/share/MailNotificationsTest.php
index c74fe40..27a728c 100644
--- a/tests/lib/share/MailNotificationsTest.php
+++ b/tests/lib/share/MailNotificationsTest.php
@@ -119,7 +119,21 @@ class MailNotificationsTest extends \Test\TestCase {
 		$this->assertSame([], $mailNotifications->sendLinkShareMail('lukas at owncloud.com', 'MyFile', 'https://owncloud.com/file/?foo=bar', 3600));
 	}
 
-	public function testSendLinkShareMailWithReplyTo() {
+	public function dataSendLinkShareMailWithReplyTo() {
+		return [
+			['lukas at owncloud.com nickvergessen at owncloud.com'],
+			['lukas at owncloud.com,nickvergessen at owncloud.com'],
+			['lukas at owncloud.com, nickvergessen at owncloud.com'],
+			['lukas at owncloud.com;nickvergessen at owncloud.com'],
+			['lukas at owncloud.com; nickvergessen at owncloud.com'],
+		];
+	}
+
+	/**
+	 * @dataProvider dataSendLinkShareMailWithReplyTo
+	 * @param string $to
+	 */
+	public function testSendLinkShareMailWithReplyTo($to) {
 		$message = $this->getMockBuilder('\OC\Mail\Message')
 			->disableOriginalConstructor()->getMock();
 
@@ -130,7 +144,7 @@ class MailNotificationsTest extends \Test\TestCase {
 		$message
 			->expects($this->once())
 			->method('setTo')
-			->with(['lukas at owncloud.com']);
+			->with(['lukas at owncloud.com', 'nickvergessen at owncloud.com']);
 		$message
 			->expects($this->once())
 			->method('setHtmlBody');
@@ -175,7 +189,7 @@ class MailNotificationsTest extends \Test\TestCase {
 			$this->logger,
 			$this->defaults
 		);
-		$this->assertSame([], $mailNotifications->sendLinkShareMail('lukas at owncloud.com', 'MyFile', 'https://owncloud.com/file/?foo=bar', 3600));
+		$this->assertSame([], $mailNotifications->sendLinkShareMail($to, 'MyFile', 'https://owncloud.com/file/?foo=bar', 3600));
 	}
 
 	public function testSendLinkShareMailException() {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list