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