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=f240665880ddc84b9ea2bd06a5fbff949cbbb149;hp=6e8a3d2d6192783d36208dd13c70c6546a0692ec;hb=e3da46d8947ab8a542a156069b3b24c13fd011df;hpb=de7568a82eb4150bf6d2b0553841b7b69f84c968 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 6e8a3d2..f240665 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPage.kt @@ -1,21 +1,22 @@ package net.pterodactylus.sone.web.pages -import net.pterodactylus.sone.web.pages.SoneTemplatePage +import net.pterodactylus.sone.main.* import net.pterodactylus.sone.web.WebInterface -import net.pterodactylus.sone.web.page.FreenetRequest +import net.pterodactylus.sone.web.page.* import net.pterodactylus.util.template.Template 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(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + SoneTemplatePage("dismissNotification.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.DismissNotification.Title") { - override fun handleRequest(request: FreenetRequest, templateContext: TemplateContext) { - val returnPage = request.httpRequest.getPartAsStringFailsafe("returnPage", 256) - val notificationId = request.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) }