Skip to content

Commit c204315

Browse files
samuelsonbritosamuelsonmesquita
authored andcommitted
feat: add dismiss button
Signed-off-by: Samuelson Brito <[email protected]>
1 parent 56b5960 commit c204315

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

lib/Notification/Notifier.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,32 @@ private function parseUpgrade(
212212
INotification $notification,
213213
IL10N $l,
214214
): INotification {
215+
215216
$parameters = $notification->getSubjectParameters();
216217
$notification->setIcon($this->url->getAbsoluteURL($this->url->imagePath(Application::APP_ID, 'app-dark.svg')));
217218
$subject = $l->t('LibreSign has been updated!');
218219
$message = $parameters['message'] ?? '';
219220
$notification->setParsedSubject($subject)
220221
->setParsedMessage($message);
222+
223+
$dismissAction = $notification->createAction()
224+
->setParsedLabel($l->t('Dismiss notification'))
225+
->setPrimary(false)
226+
->setLink(
227+
$this->url->linkToOCSRouteAbsolute(
228+
'libresign.notify.notificationDismiss',
229+
[
230+
'apiVersion' => 'v1',
231+
'timestamp' => $notification->getDateTime()->getTimestamp(),
232+
'objectType' => 'upgrade',
233+
'objectId' => '1',
234+
'subject' => 'libresign_upgrade',
235+
],
236+
),
237+
IAction::TYPE_DELETE
238+
);
239+
$notification->addParsedAction($dismissAction);
240+
221241
return $notification;
222242
}
223243
}

0 commit comments

Comments
 (0)