1 package net.pterodactylus.sone.web.pages
3 import net.pterodactylus.sone.web.WebInterface
4 import net.pterodactylus.sone.web.page.FreenetRequest
5 import net.pterodactylus.util.template.Template
6 import net.pterodactylus.util.template.TemplateContext
9 * Page that lets the user dismiss a notification.
11 class DismissNotificationPage(template: Template, webInterface: WebInterface):
12 SoneTemplatePage("dismissNotification.html", webInterface, template, "Page.DismissNotification.Title") {
14 override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
15 val returnPage = freenetRequest.httpRequest.getPartAsStringFailsafe("returnPage", 256)
16 val notificationId = freenetRequest.httpRequest.getPartAsStringFailsafe("notification", 36)
17 webInterface.getNotification(notificationId).orNull()?.takeIf { it.isDismissable }?.dismiss()
18 throw RedirectException(returnPage)