|
15 | 15 | use OCP\IUserManager; |
16 | 16 | use OCP\L10N\IFactory; |
17 | 17 | use OCP\Notification\AlreadyProcessedException; |
| 18 | +use OCP\Notification\IAction; |
18 | 19 | use OCP\Notification\INotification; |
19 | 20 | use OCP\Notification\INotifier; |
20 | 21 | use OCP\Notification\UnknownNotificationException; |
@@ -116,14 +117,23 @@ public function prepare(INotification $notification, string $languageCode): INot |
116 | 117 | 'name' => $displayName, |
117 | 118 | ]; |
118 | 119 | } |
| 120 | + |
| 121 | + $commentLink = $this->url->linkToRouteAbsolute( |
| 122 | + 'comments.Notifications.view', |
| 123 | + ['id' => $comment->getId()], |
| 124 | + ); |
| 125 | + |
119 | 126 | [$message, $messageParameters] = $this->commentToRichMessage($comment); |
120 | 127 | $notification->setRichSubject($subject, $subjectParameters) |
121 | 128 | ->setRichMessage($message, $messageParameters) |
122 | 129 | ->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/comment.svg'))) |
123 | | - ->setLink($this->url->linkToRouteAbsolute( |
124 | | - 'comments.Notifications.view', |
125 | | - ['id' => $comment->getId()]) |
126 | | - ); |
| 130 | + ->setLink($commentLink); |
| 131 | + |
| 132 | + $action = $notification->createAction(); |
| 133 | + $action->setLink($commentLink, IAction::TYPE_WEB); |
| 134 | + $action->setPrimary(true); |
| 135 | + $action->setParsedLabel($l->t('Go to file')); |
| 136 | + $notification->addParsedAction($action); |
127 | 137 |
|
128 | 138 | return $notification; |
129 | 139 | break; |
|
0 commit comments