X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FCreatePostAjaxPage.kt;h=28af3e320e947f954032ccb890eba8ca86c35d44;hp=00bc6c2894dbb56b77ee5d736bf0cbee18716664;hb=04709e23f38e9d447337682ba27201da5dc19bd9;hpb=d14188d87056cfd63490ef9f16f4aae0c1864864 diff --git a/src/main/kotlin/net/pterodactylus/sone/web/ajax/CreatePostAjaxPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/ajax/CreatePostAjaxPage.kt index 00bc6c2..28af3e3 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/ajax/CreatePostAjaxPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/ajax/CreatePostAjaxPage.kt @@ -10,7 +10,8 @@ import javax.inject.* /** * AJAX handler that creates a new post. */ -class CreatePostAjaxPage @Inject constructor(webInterface: WebInterface) : LoggedInJsonPage("createPost.ajax", webInterface) { +@ToadletPath("createPost.ajax") +class CreatePostAjaxPage @Inject constructor(webInterface: WebInterface) : LoggedInJsonPage(webInterface) { override fun createJsonObject(currentSone: Sone, request: FreenetRequest) = request.parameters["text"].emptyToNull @@ -18,7 +19,7 @@ class CreatePostAjaxPage @Inject constructor(webInterface: WebInterface) : Logge ?.let { text -> val sender = request.parameters["sender"].emptyToNull?.let(core::getSone) ?: currentSone val recipient = request.parameters["recipient"]?.let(core::getSone) - core.createPost(sender, recipient.asOptional(), text).let { post -> + core.createPost(sender, recipient, text).let { post -> createSuccessJsonObject().apply { put("postId", post.id) put("sone", sender.id)