1 package net.pterodactylus.sone.web.ajax
3 import net.pterodactylus.sone.utils.parameters
4 import net.pterodactylus.sone.web.WebInterface
5 import net.pterodactylus.sone.web.page.*
6 import javax.inject.Inject
9 * AJAX page that lets the user unbookmark a post.
11 @ToadletPath("unbookmark.ajax")
12 class UnbookmarkAjaxPage @Inject constructor(webInterface: WebInterface) : JsonPage(webInterface) {
14 override val requiresLogin = false
16 override fun createJsonObject(request: FreenetRequest) =
17 request.parameters["post"]
19 ?.also(core::unbookmarkPost)
20 ?.let { createSuccessJsonObject() }
21 ?: createErrorJsonObject("invalid-post-id")