X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FDismissNotificationPage.kt;h=a6b25de3ff34d47b06d517af459dd3480eb5c6d2;hp=78cdb8396ebc96fe4c7b17cdcf278bf10a8fcc28;hb=110a933c2724aba6a604fc5eed6372ff1e1e6144;hpb=ffd92ca2374c0b2218e583d02e0bdd24b8c110ae diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPage.kt index 78cdb83..a6b25de 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPage.kt @@ -1,20 +1,21 @@ package net.pterodactylus.sone.web.pages +import net.pterodactylus.sone.main.* import net.pterodactylus.sone.web.WebInterface -import net.pterodactylus.sone.web.page.FreenetRequest -import net.pterodactylus.util.template.Template +import net.pterodactylus.sone.web.page.* import net.pterodactylus.util.template.TemplateContext +import javax.inject.Inject /** * Page that lets the user dismiss a notification. */ -class DismissNotificationPage(template: Template, webInterface: WebInterface): - SoneTemplatePage("dismissNotification.html", template, "Page.DismissNotification.Title", webInterface) { +class DismissNotificationPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + SoneTemplatePage("dismissNotification.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.DismissNotification.Title") { - override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) { - val returnPage = freenetRequest.httpRequest.getPartAsStringFailsafe("returnPage", 256) - val notificationId = freenetRequest.httpRequest.getPartAsStringFailsafe("notification", 36) - webInterface.getNotification(notificationId).orNull()?.takeIf { it.isDismissable }?.dismiss() + override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { + val returnPage = soneRequest.httpRequest.getPartAsStringFailsafe("returnPage", 256) + val notificationId = soneRequest.httpRequest.getPartAsStringFailsafe("notification", 36) + soneRequest.webInterface.getNotification(notificationId).orNull()?.takeIf { it.isDismissable }?.dismiss() throw RedirectException(returnPage) }