X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FUnfollowSonePage.java;h=396e263658a4d454939c02fe8bb274f42873f741;hb=6f1e7806171eb6af95c8669f2ac0801e34b9246a;hp=6a9466d5e3d599d470d8df6837d4046810546c3b;hpb=5276a350f8a43e23d1cd3e30f0b8a815068f9e21;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/UnfollowSonePage.java b/src/main/java/net/pterodactylus/sone/web/UnfollowSonePage.java index 6a9466d..396e263 100644 --- a/src/main/java/net/pterodactylus/sone/web/UnfollowSonePage.java +++ b/src/main/java/net/pterodactylus/sone/web/UnfollowSonePage.java @@ -35,7 +35,7 @@ public class UnfollowSonePage extends SoneTemplatePage { * The Sone web interface */ public UnfollowSonePage(Template template, WebInterface webInterface) { - super("unfollowSone.html", template, "Page.UnfollowSone.Title", webInterface); + super("unfollowSone.html", template, "Page.UnfollowSone.Title", webInterface, true); } // @@ -49,27 +49,13 @@ public class UnfollowSonePage extends SoneTemplatePage { protected void processTemplate(Request request, Template template) throws RedirectException { super.processTemplate(request, template); if (request.getMethod() == Method.POST) { - String soneId = request.getHttpRequest().getPartAsStringFailsafe("sone", 36); + String soneId = request.getHttpRequest().getPartAsStringFailsafe("sone", 44); String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 64); Sone currentSone = getCurrentSone(request.getToadletContext()); - Sone sone = webInterface.core().getSone(soneId); - if (!sone.equals(currentSone)) { - currentSone.removeFriend(sone); - } + currentSone.removeFriend(soneId); + webInterface.getCore().saveSone(currentSone); throw new RedirectException(returnPage); } } - // - // SONETEMPLATEPAGE METHODS - // - - /** - * {@inheritDoc} - */ - @Override - protected boolean requiresLogin() { - return true; - } - }