X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FGetPostAjaxPage.kt;h=d5595d2ed4911d6943ae526f70de5bfbc78d6025;hb=bf509980d5097e67d1a32f6b53bef052b396137f;hp=7f1ce6eff3950536a93b41889f52be279dcb55f3;hpb=7afd66a21244e757b6b49ba96bb3989bc55a2abf;p=Sone.git diff --git a/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetPostAjaxPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetPostAjaxPage.kt index 7f1ce6e..d5595d2 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetPostAjaxPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetPostAjaxPage.kt @@ -6,15 +6,16 @@ import net.pterodactylus.sone.utils.jsonObject import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.utils.render import net.pterodactylus.sone.web.WebInterface -import net.pterodactylus.sone.web.page.FreenetRequest +import net.pterodactylus.sone.web.page.* import net.pterodactylus.util.template.Template +import net.pterodactylus.util.template.TemplateContextFactory import javax.inject.Inject /** * This AJAX handler retrieves information and rendered representation of a [Post]. */ -class GetPostAjaxPage @Inject constructor(webInterface: WebInterface, private val postTemplate: Template) : - LoggedInJsonPage("getPost.ajax", webInterface) { +@ToadletPath("getPost.ajax") +class GetPostAjaxPage @Inject constructor(webInterface: WebInterface, private val templateContextFactory: TemplateContextFactory, private val postTemplate: Template) : LoggedInJsonPage(webInterface) { override val needsFormPassword = false @@ -33,7 +34,7 @@ class GetPostAjaxPage @Inject constructor(webInterface: WebInterface, private va } ?: createErrorJsonObject("invalid-post-id") private fun Post.render(currentSone: Sone, request: FreenetRequest) = - webInterface.templateContextFactory.createTemplateContext().apply { + templateContextFactory.createTemplateContext().apply { set("core", core) set("request", request) set("post", this@render)