1 package net.pterodactylus.sone.web.pages
3 import net.pterodactylus.sone.main.*
4 import net.pterodactylus.sone.web.*
5 import net.pterodactylus.sone.web.page.*
6 import net.pterodactylus.util.template.*
10 * Page that lets the user dismiss a notification.
12 class DismissNotificationPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) :
13 SoneTemplatePage("dismissNotification.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.DismissNotification.Title") {
15 override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) {
16 val returnPage = soneRequest.httpRequest.getPartAsStringFailsafe("returnPage", 256)
17 val notificationId = soneRequest.httpRequest.getPartAsStringFailsafe("notification", 36)
18 soneRequest.webInterface.getNotification(notificationId).orNull()?.takeIf { it.isDismissable }?.dismiss()
19 throw RedirectException(returnPage)