X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FDistrustPage.java;h=50e3efbf71922c82543a16739f4b91873cae4e72;hp=37a792c2a4db9b7736a92043fe8070b0481aa10a;hb=7b55e0be6a3283e43a9bbab98f82aebdd948eb33;hpb=d0ae5f106a59d7ac808e03287af2e5a33e50ba8b diff --git a/src/main/java/net/pterodactylus/sone/web/DistrustPage.java b/src/main/java/net/pterodactylus/sone/web/DistrustPage.java index 37a792c..50e3efb 100644 --- a/src/main/java/net/pterodactylus/sone/web/DistrustPage.java +++ b/src/main/java/net/pterodactylus/sone/web/DistrustPage.java @@ -1,5 +1,5 @@ /* - * Sone - DistrustPage.java - Copyright © 2011 David Roden + * Sone - DistrustPage.java - Copyright © 2011–2016 David Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,11 +17,14 @@ package net.pterodactylus.sone.web; +import com.google.common.base.Optional; + import net.pterodactylus.sone.core.Core; import net.pterodactylus.sone.data.Sone; -import net.pterodactylus.sone.web.page.Page.Request.Method; +import net.pterodactylus.sone.web.page.FreenetRequest; import net.pterodactylus.util.template.Template; import net.pterodactylus.util.template.TemplateContext; +import net.pterodactylus.util.web.Method; /** * Page that lets the user distrust another Sone. This will assign a @@ -52,15 +55,14 @@ public class DistrustPage extends SoneTemplatePage { * {@inheritDoc} */ @Override - protected void processTemplate(Request request, TemplateContext templateContext) throws RedirectException { - super.processTemplate(request, templateContext); + protected void handleRequest(FreenetRequest request, TemplateContext templateContext) throws RedirectException { if (request.getMethod() == Method.POST) { String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256); String identity = request.getHttpRequest().getPartAsStringFailsafe("sone", 44); Sone currentSone = getCurrentSone(request.getToadletContext()); - Sone sone = webInterface.getCore().getSone(identity, false); - if (sone != null) { - webInterface.getCore().distrustSone(currentSone, sone); + Optional sone = webInterface.getCore().getSone(identity); + if (sone.isPresent()) { + webInterface.getCore().distrustSone(currentSone, sone.get()); } throw new RedirectException(returnPage); }