X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FBookmarkAjaxPage.kt;h=35ac0e235274352e9ce5242a9dc1ab58a7ca2066;hp=b185d2b5ad5d99d3115db7c0591755fe26a356f3;hb=fd32e307db87c617a4c455f592b6e649ec50ae8a;hpb=ff4bc3606b33e9796ff4fbae087b4224d02cf0d0 diff --git a/src/main/kotlin/net/pterodactylus/sone/web/ajax/BookmarkAjaxPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/ajax/BookmarkAjaxPage.kt index b185d2b..35ac0e2 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/ajax/BookmarkAjaxPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/ajax/BookmarkAjaxPage.kt @@ -1,6 +1,5 @@ package net.pterodactylus.sone.web.ajax -import net.pterodactylus.sone.utils.also import net.pterodactylus.sone.utils.emptyToNull import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.web.WebInterface @@ -15,9 +14,10 @@ class BookmarkAjaxPage(webInterface: WebInterface) : JsonPage("bookmark.ajax", w override fun createJsonObject(request: FreenetRequest) = request.parameters["post"].emptyToNull - ?.let(core::getPost) - ?.also(core::bookmarkPost) - ?.let { createSuccessJsonObject() } + ?.let { postId -> + core.getPost(postId)?.also(core::bookmarkPost) + createSuccessJsonObject() + } ?: createErrorJsonObject("invalid-post-id") }