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", template, "Page.DismissNotification.Title", webInterface) {
14 override fun handleRequest(request: FreenetRequest, templateContext: TemplateContext) {
15 val returnPage = request.httpRequest.getPartAsStringFailsafe("returnPage", 256)
16 val notificationId = request.httpRequest.getPartAsStringFailsafe("notification", 36)
17 webInterface.getNotification(notificationId).orNull()?.takeIf { it.isDismissable }?.dismiss()
18 throw RedirectException(returnPage)