diff options
author | Joas Schilling <coding@schilljs.com> | 2019-09-09 14:31:14 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2019-11-12 17:37:45 +0100 |
commit | 19e1892d507c52b36ec4f7e42cc1e0989158ef79 (patch) | |
tree | c20d323c91051e98d7bf4eadecc294e990e05eb4 /apps | |
parent | 43517cfac6b32a2470a0bdf2b85007b2e5b3233c (diff) | |
download | nextcloud-server-19e1892d507c52b36ec4f7e42cc1e0989158ef79.tar.gz nextcloud-server-19e1892d507c52b36ec4f7e42cc1e0989158ef79.zip |
Use constants for the magic strings
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/lib/Notification/Listener.php | 11 | ||||
-rw-r--r-- | apps/files_sharing/lib/Notification/Notifier.php | 6 |
2 files changed, 9 insertions, 8 deletions
diff --git a/apps/files_sharing/lib/Notification/Listener.php b/apps/files_sharing/lib/Notification/Listener.php index 1f8358dd3b8..9d23898e570 100644 --- a/apps/files_sharing/lib/Notification/Listener.php +++ b/apps/files_sharing/lib/Notification/Listener.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace OCA\Files_Sharing\Notification; -use OC\Share\Share; use OCP\IGroup; use OCP\IGroupManager; use OCP\IUser; @@ -61,12 +60,12 @@ class Listener { $share = $event->getSubject(); $notification = $this->instantiateNotification($share); - if ($share->getShareType() === Share::SHARE_TYPE_USER) { - $notification->setSubject('incoming_user_share') + if ($share->getShareType() === IShare::TYPE_USER) { + $notification->setSubject(Notifier::INCOMING_USER_SHARE) ->setUser($share->getSharedWith()); $this->notificationManager->notify($notification); - } else if ($share->getShareType() === Share::SHARE_TYPE_GROUP) { - $notification->setSubject('incoming_group_share'); + } else if ($share->getShareType() === IShare::TYPE_GROUP) { + $notification->setSubject(Notifier::INCOMING_GROUP_SHARE); $group = $this->groupManager->get($share->getSharedWith()); foreach ($group->getUsers() as $user) { @@ -108,7 +107,7 @@ class Listener { } $notification = $this->instantiateNotification($share); - $notification->setSubject('incoming_group_share') + $notification->setSubject(Notifier::INCOMING_GROUP_SHARE) ->setUser($user->getUID()); $this->notificationManager->notify($notification); } diff --git a/apps/files_sharing/lib/Notification/Notifier.php b/apps/files_sharing/lib/Notification/Notifier.php index 03d7038e6fe..57b96be57b2 100644 --- a/apps/files_sharing/lib/Notification/Notifier.php +++ b/apps/files_sharing/lib/Notification/Notifier.php @@ -41,6 +41,8 @@ use OCP\Share\IManager; use OCP\Share\IShare; class Notifier implements INotifier { + public const INCOMING_USER_SHARE = 'incoming_user_share'; + public const INCOMING_GROUP_SHARE = 'incoming_group_share'; /** @var IFactory */ protected $l10nFactory; @@ -158,7 +160,7 @@ class Notifier implements INotifier { } switch ($notification->getSubject()) { - case 'incoming_user_share': + case self::INCOMING_USER_SHARE: if ($share->getSharedWith() !== $notification->getUser()) { throw new AlreadyProcessedException(); } @@ -178,7 +180,7 @@ class Notifier implements INotifier { ]; break; - case 'incoming_group_share': + case self::INCOMING_GROUP_SHARE: $user = $this->userManager->get($notification->getUser()); if (!$user instanceof IUser) { throw new AlreadyProcessedException(); |