summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-08-26 14:40:02 +0200
committerJoas Schilling <coding@schilljs.com>2019-11-12 17:33:53 +0100
commitc79a56481bc4bd9fb94b0dfbf483537400c76569 (patch)
tree4dc3211679046692631de445e73a2f076c8ae91f
parente96c9e0e4a402277a9f18470c77503dd914c6de4 (diff)
downloadnextcloud-server-c79a56481bc4bd9fb94b0dfbf483537400c76569.tar.gz
nextcloud-server-c79a56481bc4bd9fb94b0dfbf483537400c76569.zip
Notifications for group shares
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--apps/files_sharing/lib/Notification/Listener.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/apps/files_sharing/lib/Notification/Listener.php b/apps/files_sharing/lib/Notification/Listener.php
index 98c40f31677..b2e00613e70 100644
--- a/apps/files_sharing/lib/Notification/Listener.php
+++ b/apps/files_sharing/lib/Notification/Listener.php
@@ -25,6 +25,7 @@ declare(strict_types=1);
namespace OCA\Files_Sharing\Notification;
use OC\Share\Share;
+use OCP\IGroupManager;
use OCP\Notification\IManager;
use OCP\Notification\INotification;
use OCP\Share\IShare;
@@ -34,11 +35,15 @@ class Listener {
/** @var IManager */
protected $notificationManager;
+ /** @var IGroupManager */
+ protected $groupManager;
public function __construct(
- IManager $notificationManager
+ IManager $notificationManager,
+ IGroupManager $groupManager
) {
$this->notificationManager = $notificationManager;
+ $this->groupManager = $groupManager;
}
/**
@@ -53,6 +58,14 @@ class Listener {
$notification->setSubject('incoming_user_share')
->setUser($share->getSharedWith());
$this->notificationManager->notify($notification);
+ } else if ($share->getShareType() === Share::SHARE_TYPE_GROUP) {
+ $notification->setSubject('incoming_group_share');
+ $group = $this->groupManager->get($share->getSharedWith());
+
+ foreach ($group->getUsers() as $user) {
+ $notification->setUser($user->getUID());
+ $this->notificationManager->notify($notification);
+ }
}
}