X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FLikeAjaxPage.kt;h=718e6e771efcc7cdb2277c5a39450670dcc046a2;hb=9db5ef551b000dc6e9b6f6683a2cce3b8e2f5223;hp=4257725f5cc38cf815f4d996ac296da6dd7b9ccc;hpb=85b7420f3492af4e5591f62ad673309a76de7e04;p=Sone.git diff --git a/src/main/kotlin/net/pterodactylus/sone/web/ajax/LikeAjaxPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/ajax/LikeAjaxPage.kt index 4257725..718e6e7 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/ajax/LikeAjaxPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/ajax/LikeAjaxPage.kt @@ -14,13 +14,13 @@ class LikeAjaxPage(webInterface: WebInterface) : LoggedInJsonPage("like.ajax", w override fun createJsonObject(currentSone: Sone, request: FreenetRequest) = when (request.parameters["type"]) { "post" -> request.parameters["post"] - .let(core::getPost) + ?.let(core::getPost) ?.let { currentSone.addLikedPostId(it.id) } ?.also { core.touchConfiguration() } ?.let { createSuccessJsonObject() } ?: createErrorJsonObject("invalid-post-id") "reply" -> request.parameters["reply"] - .let(core::getPostReply) + ?.let(core::getPostReply) ?.let { currentSone.addLikedReplyId(it.id) } ?.also { core.touchConfiguration() } ?.let { createSuccessJsonObject() }