X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FUnfollowSoneAjaxPage.kt;h=83b474cab056816b7c02be5e7ce86e28c1f74dad;hp=6889d04c68664207b64e1f565d07047e491442f8;hb=ea7ad5e87074576d17b7df74365a726bd95d7665;hpb=85b7420f3492af4e5591f62ad673309a76de7e04 diff --git a/src/main/kotlin/net/pterodactylus/sone/web/ajax/UnfollowSoneAjaxPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/ajax/UnfollowSoneAjaxPage.kt index 6889d04..83b474c 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/ajax/UnfollowSoneAjaxPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/ajax/UnfollowSoneAjaxPage.kt @@ -12,8 +12,8 @@ class UnfollowSoneAjaxPage(webInterface: WebInterface) : LoggedInJsonPage("unfol override fun createJsonObject(currentSone: Sone, request: FreenetRequest) = request.parameters["sone"] - ?.takeIf { core.getSone(it).isPresent } - ?.also { core.unfollowSone(currentSone, it) } + ?.let(core::getSone) + ?.also { core.unfollowSone(currentSone, it.id) } ?.let { createSuccessJsonObject() } ?: createErrorJsonObject("invalid-sone-id")