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