diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-10-26 18:39:53 +0300 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-11-08 23:00:36 +0300 |
commit | e13571f8f3bdd58ab8df7610e0107119a4058ab8 (patch) | |
tree | 8e046885fce9e4083275db12edde7d0701480b49 /lib/Notification/Notifier.php | |
parent | 86f7c8f0f2cb8fd6c45cdf6124d01c7536cdef17 (diff) |
Add support for link shares in "share:password" rooms
Until now only the e-mail shares had support for sending the password by
Talk. In Nextcloud 15 that feature was added to link shares too, so the
room name and the notification sent for "share:password" rooms has to be
adjusted accordingly.
The display name of "share:password" rooms is generated from the raw
name of the room (the e-mail for mail shares and the file name for link
shares) each time the room information is sent by the server, so the
display name was generalized to accomodate both types of raw names.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Notification/Notifier.php')
-rw-r--r-- | lib/Notification/Notifier.php | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index 7bf1d543c..3f7111dd8 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -37,6 +37,7 @@ use OCP\L10N\IFactory; use OCP\Notification\INotification; use OCP\Notification\INotifier; use OCP\RichObjectStrings\Definitions; +use OCP\Share; use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\IManager as IShareManager; @@ -463,19 +464,24 @@ class Notifier implements INotifier { throw new \InvalidArgumentException('Unknown share'); } - $sharedWith = $share->getSharedWith(); + if ($share->getShareType() === Share::SHARE_TYPE_EMAIL) { + $sharedWith = $share->getSharedWith(); - $notification - ->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' => [ - 'type' => 'email', - 'id' => $sharedWith, - 'name' => $sharedWith, + $notification + ->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' => [ + 'type' => 'email', + 'id' => $sharedWith, + 'name' => $sharedWith, + ] ] - ] - ); + ); + } else { + $notification + ->setParsedSubject($l->t('Someone requested the password to access a share')); + } return $notification; } |