Clean up SoneTemplatePage’s constructors
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 4 Jan 2018 20:22:25 +0000 (21:22 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 4 Jan 2018 20:22:25 +0000 (21:22 +0100)
20 files changed:
src/main/java/net/pterodactylus/sone/web/WebInterface.java
src/main/kotlin/net/pterodactylus/sone/web/pages/AboutPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/BookmarkPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/BookmarksPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/CreateSonePage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/LockSonePage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/LoggedInPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/LoginPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/NewPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/OptionsPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/SearchPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/ViewPostPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/ViewSonePage.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePageTest.kt

index 6401b43..4396f0e 100644 (file)
@@ -756,11 +756,11 @@ public class WebInterface implements SessionProvider {
                pageToadlets.add(pageToadletFactory.createPageToadlet(new OptionsPage(optionsTemplate, this), "Options"));
                pageToadlets.add(pageToadletFactory.createPageToadlet(new RescuePage(rescueTemplate, this), "Rescue"));
                pageToadlets.add(pageToadletFactory.createPageToadlet(new AboutPage(aboutTemplate, this, new PluginVersion(SonePlugin.getPluginVersion()), new PluginYear(SonePlugin.getYear()), new PluginHomepage(SonePlugin.getHomepage())), "About"));
                pageToadlets.add(pageToadletFactory.createPageToadlet(new OptionsPage(optionsTemplate, this), "Options"));
                pageToadlets.add(pageToadletFactory.createPageToadlet(new RescuePage(rescueTemplate, this), "Rescue"));
                pageToadlets.add(pageToadletFactory.createPageToadlet(new AboutPage(aboutTemplate, this, new PluginVersion(SonePlugin.getPluginVersion()), new PluginYear(SonePlugin.getYear()), new PluginHomepage(SonePlugin.getHomepage())), "About"));
-               pageToadlets.add(pageToadletFactory.createPageToadlet(new SoneTemplatePage("noPermission.html", noPermissionTemplate, "Page.NoPermission.Title", this)));
-               pageToadlets.add(pageToadletFactory.createPageToadlet(new SoneTemplatePage("emptyImageTitle.html", emptyImageTitleTemplate, "Page.EmptyImageTitle.Title", this)));
-               pageToadlets.add(pageToadletFactory.createPageToadlet(new SoneTemplatePage("emptyAlbumTitle.html", emptyAlbumTitleTemplate, "Page.EmptyAlbumTitle.Title", this)));
+               pageToadlets.add(pageToadletFactory.createPageToadlet(new SoneTemplatePage("noPermission.html", this, noPermissionTemplate, "Page.NoPermission.Title")));
+               pageToadlets.add(pageToadletFactory.createPageToadlet(new SoneTemplatePage("emptyImageTitle.html", this, emptyImageTitleTemplate, "Page.EmptyImageTitle.Title")));
+               pageToadlets.add(pageToadletFactory.createPageToadlet(new SoneTemplatePage("emptyAlbumTitle.html", this, emptyAlbumTitleTemplate, "Page.EmptyAlbumTitle.Title")));
                pageToadlets.add(pageToadletFactory.createPageToadlet(new DismissNotificationPage(emptyTemplate, this)));
                pageToadlets.add(pageToadletFactory.createPageToadlet(new DismissNotificationPage(emptyTemplate, this)));
-               pageToadlets.add(pageToadletFactory.createPageToadlet(new SoneTemplatePage("invalid.html", invalidTemplate, "Page.Invalid.Title", this)));
+               pageToadlets.add(pageToadletFactory.createPageToadlet(new SoneTemplatePage("invalid.html", this, invalidTemplate, "Page.Invalid.Title")));
                pageToadlets.add(pageToadletFactory.createPageToadlet(loaders.<FreenetRequest>loadStaticPage("css/", "/static/css/", "text/css")));
                pageToadlets.add(pageToadletFactory.createPageToadlet(loaders.<FreenetRequest>loadStaticPage("javascript/", "/static/javascript/", "text/javascript")));
                pageToadlets.add(pageToadletFactory.createPageToadlet(loaders.<FreenetRequest>loadStaticPage("images/", "/static/images/", "image/png")));
                pageToadlets.add(pageToadletFactory.createPageToadlet(loaders.<FreenetRequest>loadStaticPage("css/", "/static/css/", "text/css")));
                pageToadlets.add(pageToadletFactory.createPageToadlet(loaders.<FreenetRequest>loadStaticPage("javascript/", "/static/javascript/", "text/javascript")));
                pageToadlets.add(pageToadletFactory.createPageToadlet(loaders.<FreenetRequest>loadStaticPage("images/", "/static/images/", "image/png")));
index d3382b4..148f10e 100644 (file)
@@ -14,7 +14,7 @@ import net.pterodactylus.util.template.TemplateContext
 class AboutPage(template: Template, webInterface: WebInterface,
                private val pluginVersion: PluginVersion,
                private val pluginYear: PluginYear,
 class AboutPage(template: Template, webInterface: WebInterface,
                private val pluginVersion: PluginVersion,
                private val pluginYear: PluginYear,
-               private val pluginHomepage: PluginHomepage): SoneTemplatePage("about.html", template, "Page.About.Title", webInterface, false) {
+               private val pluginHomepage: PluginHomepage): SoneTemplatePage("about.html", webInterface, template, "Page.About.Title") {
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                templateContext["version"] = pluginVersion.version
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                templateContext["version"] = pluginVersion.version
index 7fb2320..a5c82cd 100644 (file)
@@ -10,7 +10,7 @@ import net.pterodactylus.util.template.TemplateContext
  * Page that lets the user bookmark a post.
  */
 class BookmarkPage(template: Template, webInterface: WebInterface)
  * Page that lets the user bookmark a post.
  */
 class BookmarkPage(template: Template, webInterface: WebInterface)
-       : SoneTemplatePage("bookmark.html", template, "Page.Bookmark.Title", webInterface) {
+       : SoneTemplatePage("bookmark.html", webInterface, template, "Page.Bookmark.Title") {
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                if (freenetRequest.isPOST) {
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                if (freenetRequest.isPOST) {
index fbfc7d3..8d33977 100644 (file)
@@ -10,7 +10,8 @@ import net.pterodactylus.util.template.TemplateContext
 /**
  * Page that lets the user browse all his bookmarked posts.
  */
 /**
  * Page that lets the user browse all his bookmarked posts.
  */
-class BookmarksPage(template: Template, webInterface: WebInterface): SoneTemplatePage("bookmarks.html", template, "Page.Bookmarks.Title", webInterface) {
+class BookmarksPage(template: Template, webInterface: WebInterface) :
+               SoneTemplatePage("bookmarks.html", webInterface, template, "Page.Bookmarks.Title") {
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                webInterface.core.bookmarkedPosts.let { posts ->
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                webInterface.core.bookmarkedPosts.let { posts ->
index efa6f1d..2732aac 100644 (file)
@@ -14,7 +14,7 @@ import java.util.logging.Logger
  * The “create Sone” page lets the user create a new Sone.
  */
 class CreateSonePage(template: Template, webInterface: WebInterface):
  * The “create Sone” page lets the user create a new Sone.
  */
 class CreateSonePage(template: Template, webInterface: WebInterface):
-               SoneTemplatePage("createSone.html", template, "Page.CreateSone.Title", webInterface, false) {
+               SoneTemplatePage("createSone.html", webInterface, template, "Page.CreateSone.Title") {
 
        private val logger = Logger.getLogger(CreateSonePage::class.java.name)
 
 
        private val logger = Logger.getLogger(CreateSonePage::class.java.name)
 
index 78cdb83..9f8eeb4 100644 (file)
@@ -9,7 +9,7 @@ import net.pterodactylus.util.template.TemplateContext
  * Page that lets the user dismiss a notification.
  */
 class DismissNotificationPage(template: Template, webInterface: WebInterface):
  * Page that lets the user dismiss a notification.
  */
 class DismissNotificationPage(template: Template, webInterface: WebInterface):
-               SoneTemplatePage("dismissNotification.html", template, "Page.DismissNotification.Title", webInterface) {
+               SoneTemplatePage("dismissNotification.html", webInterface, template, "Page.DismissNotification.Title") {
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                val returnPage = freenetRequest.httpRequest.getPartAsStringFailsafe("returnPage", 256)
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                val returnPage = freenetRequest.httpRequest.getPartAsStringFailsafe("returnPage", 256)
index 9d6930d..a3969b2 100644 (file)
@@ -12,7 +12,7 @@ import net.pterodactylus.util.template.TemplateContext
  * This page shows all known Sones.
  */
 class KnownSonesPage(template: Template, webInterface: WebInterface):
  * This page shows all known Sones.
  */
 class KnownSonesPage(template: Template, webInterface: WebInterface):
-               SoneTemplatePage("knownSones.html", template, "Page.KnownSones.Title", webInterface, false) {
+               SoneTemplatePage("knownSones.html", webInterface, template, "Page.KnownSones.Title") {
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                getCurrentSone(freenetRequest.toadletContext).let { currentSone ->
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                getCurrentSone(freenetRequest.toadletContext).let { currentSone ->
index 835fe23..bb4c98a 100644 (file)
@@ -10,7 +10,7 @@ import net.pterodactylus.util.template.TemplateContext
  * This page lets the user lock a [net.pterodactylus.sone.data.Sone] to prevent it from being inserted.
  */
 class LockSonePage(template: Template, webInterface: WebInterface):
  * This page lets the user lock a [net.pterodactylus.sone.data.Sone] to prevent it from being inserted.
  */
 class LockSonePage(template: Template, webInterface: WebInterface):
-               SoneTemplatePage("lockSone.html", template, "Page.LockSone.Title", webInterface, false) {
+               SoneTemplatePage("lockSone.html", webInterface, template, "Page.LockSone.Title") {
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                freenetRequest.parameters["returnPage", 256]!!.let { returnPage ->
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                freenetRequest.parameters["returnPage", 256]!!.let { returnPage ->
index c88499e..ffe65d1 100644 (file)
@@ -10,7 +10,7 @@ import net.pterodactylus.util.template.TemplateContext
  * Base class for [SoneTemplatePage] implementations that require a logged in user.
  */
 abstract class LoggedInPage(path: String, template: Template, pageTitleKey: String, webInterface: WebInterface) :
  * Base class for [SoneTemplatePage] implementations that require a logged in user.
  */
 abstract class LoggedInPage(path: String, template: Template, pageTitleKey: String, webInterface: WebInterface) :
-               SoneTemplatePage(path, template, pageTitleKey, webInterface, true) {
+               SoneTemplatePage(path, webInterface, template, pageTitleKey, true) {
 
        final override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                handleRequest(freenetRequest, getCurrentSone(freenetRequest.toadletContext, false)!!, templateContext)
 
        final override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                handleRequest(freenetRequest, getCurrentSone(freenetRequest.toadletContext, false)!!, templateContext)
index 0e0fee5..905cff4 100644 (file)
@@ -13,7 +13,7 @@ import net.pterodactylus.util.template.TemplateContext
  * The login page lets the user log in.
  */
 class LoginPage(template: Template, webInterface: WebInterface):
  * The login page lets the user log in.
  */
 class LoginPage(template: Template, webInterface: WebInterface):
-               SoneTemplatePage("login.html", template, "Page.Login.Title", webInterface) {
+               SoneTemplatePage("login.html", webInterface, template, "Page.Login.Title") {
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                if (freenetRequest.isPOST) {
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                if (freenetRequest.isPOST) {
index 49c1075..da609a6 100644 (file)
@@ -13,7 +13,7 @@ import net.pterodactylus.util.template.TemplateContext
  * [Replie][net.pterodactylus.sone.data.Reply]s as known.
  */
 class MarkAsKnownPage(template: Template, webInterface: WebInterface):
  * [Replie][net.pterodactylus.sone.data.Reply]s as known.
  */
 class MarkAsKnownPage(template: Template, webInterface: WebInterface):
-               SoneTemplatePage("markAsKnown.html", template, "Page.MarkAsKnown.Title", webInterface, false) {
+               SoneTemplatePage("markAsKnown.html", webInterface, template, "Page.MarkAsKnown.Title") {
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                val ids = freenetRequest.parameters["id", 65536]!!.split(" ")
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                val ids = freenetRequest.parameters["id", 65536]!!.split(" ")
index 55df67a..c774ceb 100644 (file)
@@ -13,7 +13,7 @@ import net.pterodactylus.util.template.TemplateContext
  * [PostVisibilityFilter.isPostVisible(Sone, Post)] and sorted by time.
  */
 class NewPage(template: Template, webInterface: WebInterface):
  * [PostVisibilityFilter.isPostVisible(Sone, Post)] and sorted by time.
  */
 class NewPage(template: Template, webInterface: WebInterface):
-               SoneTemplatePage("new.html", template, "Page.New.Title", webInterface, false) {
+               SoneTemplatePage("new.html", webInterface, template, "Page.New.Title") {
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) =
                        getCurrentSone(freenetRequest.toadletContext).let { currentSone ->
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) =
                        getCurrentSone(freenetRequest.toadletContext).let { currentSone ->
index 7cf1bb3..5205457 100644 (file)
@@ -15,7 +15,7 @@ import net.pterodactylus.util.template.TemplateContext
  * This page lets the user edit the options of the Sone plugin.
  */
 class OptionsPage(template: Template, webInterface: WebInterface):
  * This page lets the user edit the options of the Sone plugin.
  */
 class OptionsPage(template: Template, webInterface: WebInterface):
-               SoneTemplatePage("options.html", template, "Page.Options.Title", webInterface, false) {
+               SoneTemplatePage("options.html", webInterface, template, "Page.Options.Title") {
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                if (freenetRequest.isPOST) {
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                if (freenetRequest.isPOST) {
index f296e03..7cddc35 100644 (file)
@@ -28,7 +28,7 @@ import java.util.concurrent.TimeUnit.MINUTES
  * words.
  */
 class SearchPage @JvmOverloads constructor(template: Template, webInterface: WebInterface, ticker: Ticker = Ticker.systemTicker()):
  * words.
  */
 class SearchPage @JvmOverloads constructor(template: Template, webInterface: WebInterface, ticker: Ticker = Ticker.systemTicker()):
-               SoneTemplatePage("search.html", template, "Page.Search.Title", webInterface, false) {
+               SoneTemplatePage("search.html", webInterface, template, "Page.Search.Title") {
 
        private val cache: Cache<Iterable<Phrase>, Pagination<Post>> = CacheBuilder.newBuilder().ticker(ticker).expireAfterAccess(5, MINUTES).build()
 
 
        private val cache: Cache<Iterable<Phrase>, Pagination<Post>> = CacheBuilder.newBuilder().ticker(ticker).expireAfterAccess(5, MINUTES).build()
 
index 3f04236..b4178cc 100644 (file)
@@ -16,21 +16,15 @@ import java.net.URLEncoder
 /**
  * Base page for the Sone web interface.
  */
 /**
  * Base page for the Sone web interface.
  */
-open class SoneTemplatePage(
+open class SoneTemplatePage @JvmOverloads constructor(
                path: String,
                protected val webInterface: WebInterface,
                template: Template,
                private val pageTitleKey: String? = null,
                path: String,
                protected val webInterface: WebInterface,
                template: Template,
                private val pageTitleKey: String? = null,
-               private val requiresLogin: Boolean = true
+               private val requiresLogin: Boolean = false,
+               private val pageTitle: (FreenetRequest) -> String = { pageTitleKey?.let(webInterface.l10n::getString) ?: "" }
 ) : FreenetTemplatePage(path, webInterface.templateContextFactory, template, "noPermission.html") {
 
 ) : FreenetTemplatePage(path, webInterface.templateContextFactory, template, "noPermission.html") {
 
-       @JvmOverloads
-       constructor(path: String, template: Template, pageTitleKey: String?, webInterface: WebInterface, requireLogin: Boolean = false) :
-                       this(path, webInterface, template, pageTitleKey, requireLogin)
-
-       constructor(path: String, template: Template, webInterface: WebInterface, requireLogin: Boolean = true) :
-                       this(path, webInterface, template, null, requireLogin)
-
        private val core = webInterface.core
        protected val sessionProvider: SessionProvider = webInterface
 
        private val core = webInterface.core
        protected val sessionProvider: SessionProvider = webInterface
 
@@ -42,8 +36,7 @@ open class SoneTemplatePage(
 
        fun requiresLogin() = requiresLogin
 
 
        fun requiresLogin() = requiresLogin
 
-       override public fun getPageTitle(freenetRequest: FreenetRequest) =
-                       pageTitleKey?.let(webInterface.l10n::getString) ?: ""
+       override public fun getPageTitle(freenetRequest: FreenetRequest) = pageTitle(freenetRequest)
 
        override public fun getStyleSheets() =
                        listOf("css/sone.css")
 
        override public fun getStyleSheets() =
                        listOf("css/sone.css")
index c742542..ec4242b 100644 (file)
@@ -14,7 +14,7 @@ import net.pterodactylus.util.template.TemplateContext
  * Page that lets the user unbookmark a post.
  */
 class UnbookmarkPage(template: Template, webInterface: WebInterface):
  * 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(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                when {
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                when {
index e792318..0567af2 100644 (file)
@@ -11,7 +11,7 @@ import net.pterodactylus.util.template.TemplateContext
  * This page lets the user unlock a [net.pterodactylus.sone.data.Sone] to allow its insertion.
  */
 class UnlockSonePage(template: Template, webInterface: WebInterface):
  * This page lets the user unlock a [net.pterodactylus.sone.data.Sone] to allow its insertion.
  */
 class UnlockSonePage(template: Template, webInterface: WebInterface):
-               SoneTemplatePage("unlockSone.html", template, "Page.UnlockSone.Title", webInterface, false) {
+               SoneTemplatePage("unlockSone.html", webInterface, template, "Page.UnlockSone.Title") {
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                if (freenetRequest.isPOST) {
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                if (freenetRequest.isPOST) {
index 910c939..d3f4540 100644 (file)
@@ -13,7 +13,7 @@ import java.net.URI
  * This page lets the user view a post and all its replies.
  */
 class ViewPostPage(template: Template, webInterface: WebInterface):
  * This page lets the user view a post and all its replies.
  */
 class ViewPostPage(template: Template, webInterface: WebInterface):
-               SoneTemplatePage("viewPost.html", template, "Page.ViewPost.Title", webInterface, false) {
+               SoneTemplatePage("viewPost.html", webInterface, template, "Page.ViewPost.Title") {
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                templateContext["post"] = freenetRequest.parameters["post"]?.let(webInterface.core::getPost)
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                templateContext["post"] = freenetRequest.parameters["post"]?.let(webInterface.core::getPost)
index 2e175af..50b2dd7 100644 (file)
@@ -16,7 +16,7 @@ import java.net.URI
  * Lets the user browser another Sone.
  */
 class ViewSonePage(template: Template, webInterface: WebInterface):
  * Lets the user browser another Sone.
  */
 class ViewSonePage(template: Template, webInterface: WebInterface):
-               SoneTemplatePage("viewSone.html", template, webInterface, false) {
+               SoneTemplatePage("viewSone.html", webInterface, template) {
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                templateContext["soneId"] = freenetRequest.parameters["sone"]
 
        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                templateContext["soneId"] = freenetRequest.parameters["sone"]
index 3cb08e6..d8425d3 100644 (file)
@@ -20,18 +20,18 @@ import org.junit.Test
 /**
  * Unit test for [SoneTemplatePage].
  */
 /**
  * Unit test for [SoneTemplatePage].
  */
-class SoneTemplatePageTest : WebPageTest({ template, webInterface -> object : SoneTemplatePage("path.html", template, webInterface, true) {} }) {
+class SoneTemplatePageTest : WebPageTest({ template, webInterface -> object : SoneTemplatePage("path.html", webInterface, template, requiresLogin = true) {} }) {
 
        @Test
        fun `page title is empty string if no page title key was given`() {
 
        @Test
        fun `page title is empty string if no page title key was given`() {
-               SoneTemplatePage("path.html", template, null, webInterface).let { page ->
+               SoneTemplatePage("path.html", webInterface, template, requiresLogin = false).let { page ->
                        assertThat(page.getPageTitle(freenetRequest), equalTo(""))
                }
        }
 
        @Test
        fun `page title is retrieved from l10n if page title key is given`() {
                        assertThat(page.getPageTitle(freenetRequest), equalTo(""))
                }
        }
 
        @Test
        fun `page title is retrieved from l10n if page title key is given`() {
-               SoneTemplatePage("path.html", template, "page.title", webInterface).let { page ->
+               SoneTemplatePage("path.html", webInterface, template, "page.title", false).let { page ->
                        whenever(l10n.getString("page.title")).thenReturn("Page Title")
                        assertThat(page.getPageTitle(freenetRequest), equalTo("Page Title"))
                }
                        whenever(l10n.getString("page.title")).thenReturn("Page Title")
                        assertThat(page.getPageTitle(freenetRequest), equalTo("Page Title"))
                }
@@ -144,7 +144,7 @@ class SoneTemplatePageTest : WebPageTest({ template, webInterface -> object : So
        @Test
        fun `handleRequest method is called`() {
                var called = false
        @Test
        fun `handleRequest method is called`() {
                var called = false
-               val page = object : SoneTemplatePage("path.html", template, webInterface, true) {
+               val page = object : SoneTemplatePage("path.html", webInterface, template, requiresLogin = true) {
                        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                                called = true
                        }
                        override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
                                called = true
                        }
@@ -155,7 +155,7 @@ class SoneTemplatePageTest : WebPageTest({ template, webInterface -> object : So
 
        @Test
        fun `redirect does not happen if login is not required`() {
 
        @Test
        fun `redirect does not happen if login is not required`() {
-               val page = SoneTemplatePage("page.html", template, webInterface, false)
+               val page = SoneTemplatePage("page.html", webInterface, template, requiresLogin = false)
                assertThat(page.getRedirectTarget(freenetRequest), nullValue())
        }
 
                assertThat(page.getRedirectTarget(freenetRequest), nullValue())
        }
 
@@ -209,7 +209,7 @@ class SoneTemplatePageTest : WebPageTest({ template, webInterface -> object : So
 
        @Test
        fun `page is enabled if no full access is required and login is not required`() {
 
        @Test
        fun `page is enabled if no full access is required and login is not required`() {
-               SoneTemplatePage("path.html", template, webInterface, false).let { page ->
+               SoneTemplatePage("path.html", webInterface, template, requiresLogin = false).let { page ->
                        assertThat(page.isEnabled(toadletContext), equalTo(true))
                }
        }
                        assertThat(page.isEnabled(toadletContext), equalTo(true))
                }
        }