|
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; |
@@ -118,14 +119,23 @@ public function prepare(INotification $notification, string $languageCode): INot |
118 | 119 | 'name' => $displayName, |
119 | 120 | ]; |
120 | 121 | } |
| 122 | + |
| 123 | + $commentLink = $this->url->linkToRouteAbsolute( |
| 124 | + 'comments.Notifications.view', |
| 125 | + ['id' => $comment->getId()], |
| 126 | + ); |
| 127 | + |
121 | 128 | [$message, $messageParameters] = $this->commentToRichMessage($comment); |
122 | 129 | $notification->setRichSubject($subject, $subjectParameters) |
123 | 130 | ->setRichMessage($message, $messageParameters) |
124 | 131 | ->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/comment.svg'))) |
125 | | - ->setLink($this->url->linkToRouteAbsolute( |
126 | | - 'comments.Notifications.view', |
127 | | - ['id' => $comment->getId()]) |
128 | | - ); |
| 132 | + ->setLink($commentLink); |
| 133 | + |
| 134 | + $action = $notification->createAction(); |
| 135 | + $action->setLink($commentLink, IAction::TYPE_WEB); |
| 136 | + $action->setPrimary(true); |
| 137 | + $action->setParsedLabel($l->t('Go to file')); |
| 138 | + $notification->addParsedAction($action); |
129 | 139 |
|
130 | 140 | return $notification; |
131 | 141 | break; |
|
0 commit comments