diff --git a/apps/comments/lib/Controller/NotificationsController.php b/apps/comments/lib/Controller/NotificationsController.php index 6b2ade942b274..53a88f54075b7 100644 --- a/apps/comments/lib/Controller/NotificationsController.php +++ b/apps/comments/lib/Controller/NotificationsController.php @@ -80,7 +80,10 @@ public function view(string $id): RedirectResponse|NotFoundResponse { $url = $this->urlGenerator->linkToRouteAbsolute( 'files.viewcontroller.showFile', - [ 'fileid' => $comment->getObjectId() ] + [ + 'fileid' => $comment->getObjectId(), + 'opendetails' => 'true', + ] ); return new RedirectResponse($url); diff --git a/apps/comments/lib/Notification/Notifier.php b/apps/comments/lib/Notification/Notifier.php index 607d087f03ed7..c3b0542d33fac 100644 --- a/apps/comments/lib/Notification/Notifier.php +++ b/apps/comments/lib/Notification/Notifier.php @@ -15,6 +15,7 @@ use OCP\IUserManager; use OCP\L10N\IFactory; use OCP\Notification\AlreadyProcessedException; +use OCP\Notification\IAction; use OCP\Notification\INotification; use OCP\Notification\INotifier; use OCP\Notification\UnknownNotificationException; @@ -115,14 +116,23 @@ public function prepare(INotification $notification, string $languageCode): INot 'name' => $displayName, ]; } + + $commentLink = $this->url->linkToRouteAbsolute( + 'comments.Notifications.view', + ['id' => $comment->getId()], + ); + [$message, $messageParameters] = $this->commentToRichMessage($comment); $notification->setRichSubject($subject, $subjectParameters) ->setRichMessage($message, $messageParameters) ->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/comment.svg'))) - ->setLink($this->url->linkToRouteAbsolute( - 'comments.Notifications.view', - ['id' => $comment->getId()]) - ); + ->setLink($commentLink); + + $action = $notification->createAction(); + $action->setLink($commentLink, IAction::TYPE_WEB); + $action->setPrimary(true); + $action->setParsedLabel($l->t('Go to file')); + $notification->addParsedAction($action); return $notification; break;