X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FCreateAlbumPage.kt;h=b0eea08c6824d4c7fca261af4e51531be446c5a6;hp=ee3936e1e9d558372ce1dd11a92a5000d8b03921;hb=74cbe983cd38da24847e6247ac595cb70d8e115b;hpb=88ed72c4e8971a1d6e93a889f6774338d53682c6 diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateAlbumPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateAlbumPage.kt index ee3936e..b0eea08 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateAlbumPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateAlbumPage.kt @@ -1,6 +1,7 @@ package net.pterodactylus.sone.web.pages import net.pterodactylus.sone.data.Album.Modifier.AlbumTitleMustNotBeEmpty +import net.pterodactylus.sone.data.Sone import net.pterodactylus.sone.text.TextFilter import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.web.WebInterface @@ -12,9 +13,9 @@ import net.pterodactylus.util.template.TemplateContext * Page that lets the user create a new album. */ class CreateAlbumPage(template: Template, webInterface: WebInterface): - SoneTemplatePage("createAlbum.html", template, "Page.CreateAlbum.Title", webInterface, true) { + LoggedInPage("createAlbum.html", template, "Page.CreateAlbum.Title", webInterface) { - override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) { + override fun handleRequest(freenetRequest: FreenetRequest, currentSone: Sone, templateContext: TemplateContext) { if (freenetRequest.isPOST) { val name = freenetRequest.httpRequest.getPartAsStringFailsafe("name", 64).trim() if (name.isEmpty()) { @@ -22,7 +23,6 @@ class CreateAlbumPage(template: Template, webInterface: WebInterface): return } val description = freenetRequest.httpRequest.getPartAsStringFailsafe("description", 256).trim() - val currentSone = webInterface.getCurrentSoneCreatingSession(freenetRequest.toadletContext) val parentId = freenetRequest.httpRequest.getPartAsStringFailsafe("parent", 36) val parent = if (parentId == "") currentSone.rootAlbum else webInterface.core.getAlbum(parentId) val album = webInterface.core.createAlbum(currentSone, parent)