X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FEditImageAjaxPage.kt;h=b0ce04825e5c750c6de751f0a254edbbd8ee9bd8;hp=ee2cf19665fa3cbd5eaca814bb76127b52119293;hb=ea7ad5e87074576d17b7df74365a726bd95d7665;hpb=e1a0aa2cd922f84804f039f90611e7ad6a7699d0 diff --git a/src/main/kotlin/net/pterodactylus/sone/web/ajax/EditImageAjaxPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/ajax/EditImageAjaxPage.kt index ee2cf19..b0ce048 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/ajax/EditImageAjaxPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/ajax/EditImageAjaxPage.kt @@ -10,30 +10,31 @@ import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.FreenetRequest import net.pterodactylus.util.template.TemplateContext +import javax.inject.Inject /** * Page that stores a user’s image modifications. */ -class EditImageAjaxPage(webInterface: WebInterface, +class EditImageAjaxPage @Inject constructor(webInterface: WebInterface, private val parserFilter: ParserFilter, private val shortenFilter: ShortenFilter, private val renderFilter: RenderFilter) : JsonPage("editImage.ajax", webInterface) { override fun createJsonObject(request: FreenetRequest) = request.parameters["image"] - .let(webInterface.core::getImage) + .let(core::getImage) ?.let { image -> image.sone.isLocal.ifTrue { when { request.parameters["moveLeft"] == "true" -> createSuccessJsonObject().apply { put("sourceImageId", image.id) put("destinationImageId", image.album.moveImageUp(image).id) - webInterface.core.touchConfiguration() + core.touchConfiguration() } request.parameters["moveRight"] == "true" -> createSuccessJsonObject().apply { put("sourceImageId", image.id) put("destinationImageId", image.album.moveImageDown(image).id) - webInterface.core.touchConfiguration() + core.touchConfiguration() } else -> request.parameters["title"]!!.let { title -> title.trim().isNotBlank().ifTrue { @@ -52,7 +53,7 @@ class EditImageAjaxPage(webInterface: WebInterface, } } }) - webInterface.core.touchConfiguration() + core.touchConfiguration() } } }