diff options
author | Joas Schilling <coding@schilljs.com> | 2018-10-22 13:01:11 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2018-10-22 13:01:11 +0300 |
commit | d612e845f92dfe086771aea47f70a295486b0526 (patch) | |
tree | 4f140056e2f6d7337baa6b6b14002e37f95f2bea /lib/Notification/Notifier.php | |
parent | 62e7465a6dfe6fa0a16069b9c944775880534685 (diff) |
Better notifications for password shares
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Notification/Notifier.php')
-rw-r--r-- | lib/Notification/Notifier.php | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index 9d5a36dbd..6e59221c7 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -112,14 +112,14 @@ class Notifier implements INotifier { return $this->parseInvitation($notification, $room, $l); } if ($subject === 'call') { + if ($room->getObjectType() === 'share:password') { + return $this->parsePasswordRequest($notification, $room, $l); + } return $this->parseCall($notification, $room, $l); } if ($subject === 'mention' || $subject === 'chat') { return $this->parseChatMessage($notification, $room, $l); } - if ($subject === 'share:password') { - return $this->parsePasswordRequest($notification, $room, $l); - } throw new \InvalidArgumentException('Unknown subject'); } @@ -445,18 +445,15 @@ class Notifier implements INotifier { * @return INotification * @throws \InvalidArgumentException */ - protected function parsePasswordRequest(INotification $notification, Room $room, IL10N $l) { - if ($notification->getObjectType() !== 'room') { + protected function parsePasswordRequest(INotification $notification, Room $room, IL10N $l): INotification { + if ($notification->getObjectType() !== 'call') { throw new \InvalidArgumentException('Unknown object type'); } - $parameters = $notification->getSubjectParameters(); - $sharedWith = $parameters['sharedWith']; + $sharedWith = $room->getName(); $notification - ->setParsedSubject( - $l->t('Password request by %s', [$sharedWith]) - ) + ->setParsedSubject(str_replace('{email}', $sharedWith, $l->t('{email} requested the password to access a share'))) ->setRichSubject( $l->t('{email} requested the password to access a share'), [ 'email' => [ |