Replace Sone provider interface with Kotlin version
[Sone.git] / src / main / kotlin / net / pterodactylus / sone / web / ajax / UnfollowSoneAjaxPage.kt
index 6889d04..83b474c 100644 (file)
@@ -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")