diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-12-01 12:05:40 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-12-02 21:25:05 +0100 |
commit | eebe2b9c239a7f9e7e127f52ab4b9e97763b0149 (patch) | |
tree | 81d9d855b7b6e0d5fb387cd5e8c6092f17e21de3 /lib/private/share | |
parent | df5872ec50a68de5d99bd6b5cf17ceb94f2ef833 (diff) | |
download | nextcloud-server-eebe2b9c239a7f9e7e127f52ab4b9e97763b0149.tar.gz nextcloud-server-eebe2b9c239a7f9e7e127f52ab4b9e97763b0149.zip |
User IUser::getEMailAddress() all over the place
Diffstat (limited to 'lib/private/share')
-rw-r--r-- | lib/private/share/mailnotifications.php | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/lib/private/share/mailnotifications.php b/lib/private/share/mailnotifications.php index 2797e5ed99b..c7747fd38c1 100644 --- a/lib/private/share/mailnotifications.php +++ b/lib/private/share/mailnotifications.php @@ -28,11 +28,12 @@ namespace OC\Share; use DateTime; -use OCP\IConfig; use OCP\IL10N; +use OCP\IUser; use OCP\Mail\IMailer; use OCP\ILogger; use OCP\Defaults; +use OCP\Util; /** * Class MailNotifications @@ -41,16 +42,14 @@ use OCP\Defaults; */ class MailNotifications { - /** @var string sender userId */ - private $userId; + /** @var IUser sender userId */ + private $user; /** @var string sender email address */ private $replyTo; /** @var string */ private $senderDisplayName; /** @var IL10N */ private $l; - /** @var IConfig */ - private $config; /** @var IMailer */ private $mailer; /** @var Defaults */ @@ -59,34 +58,31 @@ class MailNotifications { private $logger; /** - * @param string $uid user id - * @param IConfig $config + * @param IUser $user * @param IL10N $l10n * @param IMailer $mailer * @param ILogger $logger * @param Defaults $defaults */ - public function __construct($uid, - IConfig $config, + public function __construct(IUser $user, IL10N $l10n, IMailer $mailer, ILogger $logger, Defaults $defaults) { $this->l = $l10n; - $this->userId = $uid; - $this->config = $config; + $this->user = $user; $this->mailer = $mailer; $this->logger = $logger; $this->defaults = $defaults; - $this->replyTo = $this->config->getUserValue($this->userId, 'settings', 'email', null); - $this->senderDisplayName = \OCP\User::getDisplayName($this->userId); + $this->replyTo = $this->user->getEMailAddress(); + $this->senderDisplayName = $this->user->getDisplayName(); } /** * inform users if a file was shared with them * - * @param array $recipientList list of recipients + * @param IUser[] $recipientList list of recipients * @param string $itemSource shared item source * @param string $itemType shared item type * @return array list of user to whom the mail send operation failed @@ -95,8 +91,8 @@ class MailNotifications { $noMail = []; foreach ($recipientList as $recipient) { - $recipientDisplayName = \OCP\User::getDisplayName($recipient); - $to = $this->config->getUserValue($recipient, 'settings', 'email', ''); + $recipientDisplayName = $recipient->getDisplayName(); + $to = $recipient->getEMailAddress(); if ($to === '') { $noMail[] = $recipientDisplayName; @@ -233,4 +229,14 @@ class MailNotifications { return [$htmlMail, $plainTextMail]; } + /** + * @param $itemSource + * @param $itemType + * @param IUser $recipient + * @return array + */ + protected function getItemSharedWithUser($itemSource, $itemType, $recipient) { + return Share::getItemSharedWithUser($itemType, $itemSource, $recipient->getUID()); + } + } |