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=229765d2dbce6cdfed4a0264433f524c6decc0bb;hb=ea7ad5e87074576d17b7df74365a726bd95d7665;hpb=041a849c146bb1aa8980f97f3c2adb6653b6f8ca 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 229765d..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 { webInterface.core.getSone(it).isPresent } - ?.also { webInterface.core.unfollowSone(currentSone, it) } + ?.let(core::getSone) + ?.also { core.unfollowSone(currentSone, it.id) } ?.let { createSuccessJsonObject() } ?: createErrorJsonObject("invalid-sone-id")