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=cd348e75f28bb6b8c44be3948d12a5cc23218535;hp=f240665880ddc84b9ea2bd06a5fbff949cbbb149;hb=faf66247a34f64946990a985d2ea3003465969cb;hpb=e3da46d8947ab8a542a156069b3b24c13fd011df 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 f240665..cd348e7 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPage.kt @@ -1,23 +1,23 @@ package net.pterodactylus.sone.web.pages import net.pterodactylus.sone.main.* -import net.pterodactylus.sone.web.WebInterface +import net.pterodactylus.sone.web.* import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template -import net.pterodactylus.util.template.TemplateContext -import javax.inject.Inject +import net.pterodactylus.util.template.* +import javax.inject.* /** * Page that lets the user dismiss a notification. */ -class DismissNotificationPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - SoneTemplatePage("dismissNotification.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.DismissNotification.Title") { +@ToadletPath("dismissNotification.html") +class DismissNotificationPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : + SoneTemplatePage(webInterface, loaders, templateRenderer, pageTitleKey = "Page.DismissNotification.Title") { 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) + redirectTo(returnPage) } }