X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FUnbookmarkPage.kt;h=aa7bbf6476675e452b660ad3c775768cc686c9f8;hp=804390ec5fa83ded2950e7bc14e8182de3ed2d08;hb=aaf780d3c2a6f5ce47295786f3963c8b93f6a145;hpb=6a3f1fede0cda5cd6ed56204aa1dd37a19813cb9 diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPage.kt index 804390e..aa7bbf6 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPage.kt @@ -11,8 +11,9 @@ import javax.inject.* /** * Page that lets the user unbookmark a post. */ -class UnbookmarkPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders): - SoneTemplatePage("unbookmark.html", webInterface, loaders, template = template, pageTitleKey = "Page.Unbookmark.Title") { +@ToadletPath("unbookmark.html") +class UnbookmarkPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : + SoneTemplatePage(webInterface, loaders, templateRenderer, pageTitleKey = "Page.Unbookmark.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { when { @@ -20,13 +21,13 @@ class UnbookmarkPage @Inject constructor(template: Template, webInterface: WebIn soneRequest.core.bookmarkedPosts .filterNot(Post::isLoaded) .forEach(soneRequest.core::unbookmarkPost) - throw RedirectException("bookmarks.html") + redirectTo("bookmarks.html") } soneRequest.isPOST -> { soneRequest.parameters["post", 36] ?.let(soneRequest.core::getPost) ?.also(soneRequest.core::unbookmarkPost) - throw RedirectException(soneRequest.parameters["returnPage", 256]) + redirectTo(soneRequest.parameters["returnPage", 256]) } } }