mirror of
https://github.com/nextcloud/server.git
synced 2026-05-22 01:55:56 -04:00
fix(comments): Add an action to comment notification that dismisses it
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
2c21d7517b
commit
dab6507e27
2 changed files with 18 additions and 5 deletions
|
|
@ -79,7 +79,10 @@ class NotificationsController extends Controller {
|
|||
|
||||
$url = $this->urlGenerator->linkToRouteAbsolute(
|
||||
'files.viewcontroller.showFile',
|
||||
[ 'fileid' => $comment->getObjectId() ]
|
||||
[
|
||||
'fileid' => $comment->getObjectId(),
|
||||
'opendetails' => 'true',
|
||||
]
|
||||
);
|
||||
|
||||
return new RedirectResponse($url);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ use OCP\IURLGenerator;
|
|||
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;
|
||||
|
|
@ -116,14 +117,23 @@ class Notifier implements INotifier {
|
|||
'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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue