diff options
Diffstat (limited to 'apps/files_reminders')
-rw-r--r-- | apps/files_reminders/lib/Model/RichReminder.php | 5 | ||||
-rw-r--r-- | apps/files_reminders/lib/Notification/Notifier.php | 5 | ||||
-rw-r--r-- | apps/files_reminders/lib/Service/ReminderService.php | 4 |
3 files changed, 6 insertions, 8 deletions
diff --git a/apps/files_reminders/lib/Model/RichReminder.php b/apps/files_reminders/lib/Model/RichReminder.php index 10dc89799fe..f621a8f16d5 100644 --- a/apps/files_reminders/lib/Model/RichReminder.php +++ b/apps/files_reminders/lib/Model/RichReminder.php @@ -45,11 +45,10 @@ class RichReminder extends Reminder implements JsonSerializable { * @throws NodeNotFoundException */ public function getNode(): Node { - $nodes = $this->root->getUserFolder($this->getUserId())->getById($this->getFileId()); - if (empty($nodes)) { + $node = $this->root->getUserFolder($this->getUserId())->getFirstNodeById($this->getFileId()); + if (!$node) { throw new NodeNotFoundException(); } - $node = reset($nodes); return $node; } diff --git a/apps/files_reminders/lib/Notification/Notifier.php b/apps/files_reminders/lib/Notification/Notifier.php index f7ffa0b4437..a280c4d9336 100644 --- a/apps/files_reminders/lib/Notification/Notifier.php +++ b/apps/files_reminders/lib/Notification/Notifier.php @@ -69,11 +69,10 @@ class Notifier implements INotifier { $params = $notification->getSubjectParameters(); $fileId = $params['fileId']; - $nodes = $this->root->getUserFolder($notification->getUser())->getById($fileId); - if (empty($nodes)) { + $node = $this->root->getUserFolder($notification->getUser())->getFirstNodeById($fileId); + if (!$node) { throw new InvalidArgumentException(); } - $node = reset($nodes); $path = rtrim($node->getPath(), '/'); if (strpos($path, '/' . $notification->getUser() . '/files/') === 0) { diff --git a/apps/files_reminders/lib/Service/ReminderService.php b/apps/files_reminders/lib/Service/ReminderService.php index fabca65c45a..9d5daf0cc5e 100644 --- a/apps/files_reminders/lib/Service/ReminderService.php +++ b/apps/files_reminders/lib/Service/ReminderService.php @@ -98,8 +98,8 @@ class ReminderService { $this->reminderMapper->update($reminder); return false; } catch (DoesNotExistException $e) { - $nodes = $this->root->getUserFolder($user->getUID())->getById($fileId); - if (empty($nodes)) { + $node = $this->root->getUserFolder($user->getUID())->getFirstNodeById($fileId); + if (!$node) { throw new NodeNotFoundException(); } // Create new reminder if no reminder is found |