diff --git a/apps/comments/appinfo/routes.php b/apps/comments/appinfo/routes.php index ab751ddb2a..66b3abe61b 100644 --- a/apps/comments/appinfo/routes.php +++ b/apps/comments/appinfo/routes.php @@ -20,9 +20,8 @@ * */ -use \OCA\Comments\AppInfo\Application; - -$application = new Application(); -$application->registerRoutes($this, ['routes' => [ - ['name' => 'Notifications#view', 'url' => '/notifications/view/{id}', 'verb' => 'GET'], -]]); +return [ + 'routes' => [ + ['name' => 'Notifications#view', 'url' => '/notifications/view/{id}', 'verb' => 'GET'], + ] +]; diff --git a/apps/comments/lib/Activity/Listener.php b/apps/comments/lib/Activity/Listener.php index 16852296cf..94176921f0 100644 --- a/apps/comments/lib/Activity/Listener.php +++ b/apps/comments/lib/Activity/Listener.php @@ -84,7 +84,7 @@ class Listener { // Get all mount point owners $cache = $this->mountCollection->getMountCache(); - $mounts = $cache->getMountsForFileId($event->getComment()->getObjectId()); + $mounts = $cache->getMountsForFileId((int)$event->getComment()->getObjectId()); if (empty($mounts)) { return; } @@ -93,7 +93,7 @@ class Listener { foreach ($mounts as $mount) { $owner = $mount->getUser()->getUID(); $ownerFolder = $this->rootFolder->getUserFolder($owner); - $nodes = $ownerFolder->getById($event->getComment()->getObjectId()); + $nodes = $ownerFolder->getById((int)$event->getComment()->getObjectId()); if (!empty($nodes)) { /** @var Node $node */ $node = array_shift($nodes); diff --git a/apps/comments/lib/Activity/Provider.php b/apps/comments/lib/Activity/Provider.php index 7bf686e796..ea4810f92e 100644 --- a/apps/comments/lib/Activity/Provider.php +++ b/apps/comments/lib/Activity/Provider.php @@ -147,7 +147,7 @@ class Provider implements IProvider { trim($subjectParameters[1], '/'), ])) ->setRichSubject($this->l->t('You commented on {file}'), [ - 'file' => $this->generateFileParameter($event->getObjectId(), $subjectParameters[1]), + 'file' => $this->generateFileParameter((int)$event->getObjectId(), $subjectParameters[1]), ]); } else { $author = $this->generateUserParameter($subjectParameters[0]); @@ -157,7 +157,7 @@ class Provider implements IProvider { ])) ->setRichSubject($this->l->t('{author} commented on {file}'), [ 'author' => $author, - 'file' => $this->generateFileParameter($event->getObjectId(), $subjectParameters[1]), + 'file' => $this->generateFileParameter((int)$event->getObjectId(), $subjectParameters[1]), ]); } } else { @@ -173,7 +173,7 @@ class Provider implements IProvider { protected function parseMessage(IEvent $event) { $messageParameters = $event->getMessageParameters(); try { - $comment = $this->commentsManager->get((int) $messageParameters[0]); + $comment = $this->commentsManager->get((string) $messageParameters[0]); $message = $comment->getMessage(); $message = str_replace("\n", '
', str_replace(['<', '>'], ['<', '>'], $message)); diff --git a/apps/comments/lib/Controller/Notifications.php b/apps/comments/lib/Controller/Notifications.php index c2a8175d17..9a07e2fbad 100644 --- a/apps/comments/lib/Controller/Notifications.php +++ b/apps/comments/lib/Controller/Notifications.php @@ -96,7 +96,7 @@ class Notifications extends Controller { if($comment->getObjectType() !== 'files') { return new NotFoundResponse(); } - $files = $this->folder->getById($comment->getObjectId()); + $files = $this->folder->getById((int)$comment->getObjectId()); if(count($files) === 0) { $this->markProcessed($comment); return new NotFoundResponse(); diff --git a/apps/comments/lib/Notification/Notifier.php b/apps/comments/lib/Notification/Notifier.php index 09092da539..60dd85f74c 100644 --- a/apps/comments/lib/Notification/Notifier.php +++ b/apps/comments/lib/Notification/Notifier.php @@ -94,7 +94,7 @@ class Notifier implements INotifier { throw new \InvalidArgumentException('Unsupported comment object'); } $userFolder = $this->rootFolder->getUserFolder($notification->getUser()); - $nodes = $userFolder->getById($parameters[1]); + $nodes = $userFolder->getById((int)$parameters[1]); if(empty($nodes)) { throw new \InvalidArgumentException('Cannot resolve file id to Node instance'); }