Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2018-08-08 15:15:56 +0300
committerGitHub <noreply@github.com>2018-08-08 15:15:56 +0300
commitfbe0f569933db0ea64575b2ab3f1b7241b1edcaf (patch)
tree3f9a559a5fc139beb0aecc178ba35ae6cc792826 /lib/Notification
parent551336eca458831e9d5c64bd74622f621d42459d (diff)
parent112c73b71cbc642937f8f2f2c9d903c014fd8f70 (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.php35
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;
+ }
}