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