mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 23:23:51 +00:00
notification: update comment and api endpoint for marking as read/unread
This commit is contained in:
@@ -22,9 +22,11 @@ final class NotificationVoter extends Voter
|
||||
{
|
||||
public const COMMENT_EDIT = 'CHILL_MAIN_NOTIFICATION_COMMENT_EDIT';
|
||||
|
||||
public const SEE = 'CHILL_MAIN_NOTIFICATION_SEE';
|
||||
public const NOTIFICATION_SEE = 'CHILL_MAIN_NOTIFICATION_SEE';
|
||||
|
||||
public const UPDATE = 'CHILL_MAIN_NOTIFICATION_UPDATE';
|
||||
public const NOTIFICATION_TOGGLE_READ_STATUS = 'CHILL_MAIIN_NOTIFICATION_TOGGLE_READ_STATUS';
|
||||
|
||||
public const NOTIFICATION_UPDATE = 'CHILL_MAIN_NOTIFICATION_UPDATE';
|
||||
|
||||
protected function supports($attribute, $subject): bool
|
||||
{
|
||||
@@ -45,10 +47,11 @@ final class NotificationVoter extends Voter
|
||||
|
||||
if ($subject instanceof Notification) {
|
||||
switch ($attribute) {
|
||||
case self::SEE:
|
||||
case self::NOTIFICATION_SEE:
|
||||
case self::NOTIFICATION_TOGGLE_READ_STATUS:
|
||||
return $subject->getSender() === $user || $subject->getAddressees()->contains($user);
|
||||
|
||||
case self::UPDATE:
|
||||
case self::NOTIFICATION_UPDATE:
|
||||
return $subject->getSender() === $user;
|
||||
|
||||
default:
|
||||
|
Reference in New Issue
Block a user