Clean up SoneTemplatePage’s constructors
[Sone.git] / src / main / kotlin / net / pterodactylus / sone / web / pages / UnbookmarkPage.kt
index 6af1bcf..ec4242b 100644 (file)
@@ -14,21 +14,21 @@ import net.pterodactylus.util.template.TemplateContext
  * Page that lets the user unbookmark a post.
  */
 class UnbookmarkPage(template: Template, webInterface: WebInterface):
-               SoneTemplatePage("unbookmark.html", template, "Page.Unbookmark.Title", webInterface, false) {
+               SoneTemplatePage("unbookmark.html", webInterface, template, "Page.Unbookmark.Title") {
 
-       override fun handleRequest(request: FreenetRequest, templateContext: TemplateContext) {
+       override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                when {
-                       request.isGET && (request.parameters["post"] == "allNotLoaded") -> {
+                       freenetRequest.isGET && (freenetRequest.parameters["post"] == "allNotLoaded") -> {
                                webInterface.core.bookmarkedPosts
                                                .filterNot(Post::isLoaded)
                                                .forEach(webInterface.core::unbookmarkPost)
                                throw RedirectException("bookmarks.html")
                        }
-                       request.isPOST -> {
-                               request.parameters["post", 36]
-                                               .let(webInterface.core::getPost)
-                                               .also(webInterface.core::unbookmarkPost)
-                               throw RedirectException(request.parameters["returnPage", 256])
+                       freenetRequest.isPOST -> {
+                               freenetRequest.parameters["post", 36]
+                                               ?.let(webInterface.core::getPost)
+                                               ?.also(webInterface.core::unbookmarkPost)
+                               throw RedirectException(freenetRequest.parameters["returnPage", 256])
                        }
                }
        }