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 @ToadletPath("dismissNotification.html")
13 class DismissNotificationPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) :
14 SoneTemplatePage(webInterface, loaders, templateRenderer, pageTitleKey = "Page.DismissNotification.Title") {
16 override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) {
17 val returnPage = soneRequest.httpRequest.getPartAsStringFailsafe("returnPage", 256)
18 val notificationId = soneRequest.httpRequest.getPartAsStringFailsafe("notification", 36)
19 soneRequest.webInterface.getNotification(notificationId).orNull()?.takeIf { it.isDismissable }?.dismiss()
20 throw RedirectException(returnPage)