Fix Comments
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
19b039e6e0
commit
201bbb962c
5 changed files with 12 additions and 13 deletions
|
@ -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'],
|
||||
]
|
||||
];
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue