diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2018-08-08 15:15:56 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-08 15:15:56 +0300 |
commit | fbe0f569933db0ea64575b2ab3f1b7241b1edcaf (patch) | |
tree | 3f9a559a5fc139beb0aecc178ba35ae6cc792826 /lib/Notification | |
parent | 551336eca458831e9d5c64bd74622f621d42459d (diff) | |
parent | 112c73b71cbc642937f8f2f2c9d903c014fd8f70 (diff) |
Merge pull request #1049 from nextcloud/add-support-for-sending-the-password-for-a-share-by-nextcloud-talk
Add support for sending the password for a share by Nextcloud Talk
Diffstat (limited to 'lib/Notification')
-rw-r--r-- | lib/Notification/Notifier.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index 4ca93281e..e1e60bdda 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -117,6 +117,9 @@ class Notifier implements INotifier { if ($subject === 'mention' || $subject === 'chat') { return $this->parseMention($notification, $room, $l); } + if ($subject === 'share:password') { + return $this->parsePasswordRequest($notification, $room, $l); + } throw new \InvalidArgumentException('Unknown subject'); } @@ -431,4 +434,36 @@ class Notifier implements INotifier { return $notification; } + + /** + * @param INotification $notification + * @param Room $room + * @param IL10N $l + * @return INotification + * @throws \InvalidArgumentException + */ + protected function parsePasswordRequest(INotification $notification, Room $room, IL10N $l) { + if ($notification->getObjectType() !== 'room') { + throw new \InvalidArgumentException('Unknown object type'); + } + + $parameters = $notification->getSubjectParameters(); + $sharedWith = $parameters['sharedWith']; + + $notification + ->setParsedSubject( + $l->t('Password request by %s', [$sharedWith]) + ) + ->setRichSubject( + $l->t('{email} requested the password to access a share'), [ + 'email' => [ + 'type' => 'email', + 'id' => $sharedWith, + 'name' => $sharedWith, + ] + ] + ); + + return $notification; + } } |