diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2017-07-20 09:04:56 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2017-08-01 08:20:16 +0200 |
commit | 201bbb962c982ca9aa5d1aed52fef2c587055ea3 (patch) | |
tree | 609dbd3c6a2e4886c0669cbcd87fcb895fdda7c4 /apps/comments | |
parent | 19b039e6e0d4f3955758e001d62c93aca90424d3 (diff) | |
download | nextcloud-server-201bbb962c982ca9aa5d1aed52fef2c587055ea3.tar.gz nextcloud-server-201bbb962c982ca9aa5d1aed52fef2c587055ea3.zip |
Fix Comments
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/comments')
-rw-r--r-- | apps/comments/appinfo/routes.php | 11 | ||||
-rw-r--r-- | apps/comments/lib/Activity/Listener.php | 4 | ||||
-rw-r--r-- | apps/comments/lib/Activity/Provider.php | 6 | ||||
-rw-r--r-- | apps/comments/lib/Controller/Notifications.php | 2 | ||||
-rw-r--r-- | apps/comments/lib/Notification/Notifier.php | 2 |
5 files changed, 12 insertions, 13 deletions
diff --git a/apps/comments/appinfo/routes.php b/apps/comments/appinfo/routes.php index ab751ddb2a2..66b3abe61be 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 16852296cf1..94176921f05 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 7bf686e796e..ea4810f92ed 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", '<br />', str_replace(['<', '>'], ['<', '>'], $message)); diff --git a/apps/comments/lib/Controller/Notifications.php b/apps/comments/lib/Controller/Notifications.php index c2a8175d17a..9a07e2fbad7 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 09092da539c..60dd85f74c5 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'); } |