1 package net.pterodactylus.sone.web.ajax
3 import net.pterodactylus.sone.data.*
4 import net.pterodactylus.sone.utils.*
5 import net.pterodactylus.sone.web.*
6 import net.pterodactylus.sone.web.page.*
10 * This AJAX page deletes a post.
12 @ToadletPath("deletePost.ajax")
13 class DeletePostAjaxPage @Inject constructor(webInterface: WebInterface) : LoggedInJsonPage(webInterface) {
15 override fun createJsonObject(currentSone: Sone, request: FreenetRequest) =
16 request.parameters["post"]
19 post.sone.isLocal.ifTrue {
20 createSuccessJsonObject().also {
23 } ?: createErrorJsonObject("not-authorized")
24 } ?: createErrorJsonObject("invalid-post-id")