X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FGetLikesAjaxPage.kt;h=77e2c872b71785ec0549dab592e169550ea1e32f;hb=9db5ef551b000dc6e9b6f6683a2cce3b8e2f5223;hp=12e8309dd192df9f89e4e1b52ab10b37d872cd96;hpb=85b7420f3492af4e5591f62ad673309a76de7e04;p=Sone.git diff --git a/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetLikesAjaxPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetLikesAjaxPage.kt index 12e8309..77e2c87 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetLikesAjaxPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetLikesAjaxPage.kt @@ -15,17 +15,17 @@ import net.pterodactylus.sone.web.page.FreenetRequest */ class GetLikesAjaxPage(webInterface: WebInterface) : JsonPage("getLikes.ajax", webInterface) { - override fun needsFormPassword() = false + override val needsFormPassword = false override fun createJsonObject(request: FreenetRequest) = when (request.parameters["type"]) { "post" -> request.parameters["post"] - .let(core::getPost) + ?.let(core::getPost) ?.let(core::getLikes) ?.toReply() ?: createErrorJsonObject("invalid-post-id") "reply" -> request.parameters["reply"] - .let(core::getPostReply) + ?.let(core::getPostReply) ?.let(core::getLikes) ?.toReply() ?: createErrorJsonObject("invalid-reply-id")