1 package net.pterodactylus.sone.web.pages
3 import net.pterodactylus.sone.data.Sone
4 import net.pterodactylus.sone.utils.isPOST
5 import net.pterodactylus.sone.web.WebInterface
6 import net.pterodactylus.sone.web.page.FreenetRequest
7 import net.pterodactylus.util.template.Template
8 import net.pterodactylus.util.template.TemplateContext
11 * Page that lets the user distrust another Sone. This will assign a
12 * configurable (negative) amount of trust to an identity.
14 * @see net.pterodactylus.sone.core.Core#distrustSone(Sone, Sone)
16 class DistrustPage(template: Template, webInterface: WebInterface):
17 LoggedInPage("distrust.html", template, "Page.Distrust.Title", webInterface) {
19 override fun handleRequest(freenetRequest: FreenetRequest, currentSone: Sone, templateContext: TemplateContext) {
20 if (freenetRequest.isPOST) {
21 webInterface.core.getSone(freenetRequest.httpRequest.getPartAsStringFailsafe("sone", 44))
22 ?.run { webInterface.core.distrustSone(currentSone, this) }
23 throw RedirectException(freenetRequest.httpRequest.getPartAsStringFailsafe("returnPage", 256))