Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Notifications for group shares
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Nov 12, 2019
commit c79a56481bc4bd9fb94b0dfbf483537400c76569
15 changes: 14 additions & 1 deletion apps/files_sharing/lib/Notification/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
namespace OCA\Files_Sharing\Notification;

use OC\Share\Share;
use OCP\IGroupManager;
use OCP\Notification\IManager;
use OCP\Notification\INotification;
use OCP\Share\IShare;
Expand All @@ -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;
}

/**
Expand All @@ -53,6 +58,14 @@ public function shareNotification(GenericEvent $event): void {
$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);
}
}
}

Expand Down