1 package net.pterodactylus.sone.web.pages
3 import net.pterodactylus.sone.utils.isPOST
4 import net.pterodactylus.sone.web.pages.SoneTemplatePage
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 SoneTemplatePage("distrust.html", template, "Page.Distrust.Title", webInterface, true) {
19 override fun handleRequest(request: FreenetRequest, templateContext: TemplateContext) {
21 val sone = webInterface.core.getSone(request.httpRequest.getPartAsStringFailsafe("sone", 44)).orNull()
22 sone?.run { webInterface.core.distrustSone(getCurrentSone(request.toadletContext), this) }
23 throw RedirectException(request.httpRequest.getPartAsStringFailsafe("returnPage", 256))