1 package net.pterodactylus.sone.web.ajax
3 import net.pterodactylus.sone.data.Sone
4 import net.pterodactylus.sone.utils.parameters
5 import net.pterodactylus.sone.web.WebInterface
6 import net.pterodactylus.sone.web.page.FreenetRequest
9 * AJAX page that lets a Sone unfollow another Sone.
11 class UnfollowSoneAjaxPage(webInterface: WebInterface) : LoggedInJsonPage("unfollowSone.ajax", webInterface) {
13 override fun createJsonObject(currentSone: Sone, request: FreenetRequest) =
14 request.parameters["sone"]
16 ?.also { core.unfollowSone(currentSone, it.id) }
17 ?.let { createSuccessJsonObject() }
18 ?: createErrorJsonObject("invalid-sone-id")