X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FFollowSonePage.java;h=0367f6ac53a90fb8e712445dfb89d5045f8f17c4;hb=62ebf3da00001abb841c92128c4fdb57d0795ee2;hp=36bb1a4725d4c1023f5b615e786d331725d4ff66;hpb=eca036999a92aa8d0537bab0403dc7edec4b874c;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/FollowSonePage.java b/src/main/java/net/pterodactylus/sone/web/FollowSonePage.java index 36bb1a4..0367f6a 100644 --- a/src/main/java/net/pterodactylus/sone/web/FollowSonePage.java +++ b/src/main/java/net/pterodactylus/sone/web/FollowSonePage.java @@ -35,7 +35,7 @@ public class FollowSonePage extends SoneTemplatePage { * The Sone web interface */ public FollowSonePage(Template template, WebInterface webInterface) { - super("followSone.html", template, "Page.FollowSone.Title", webInterface); + super("followSone.html", template, "Page.FollowSone.Title", webInterface, true); } // @@ -49,27 +49,13 @@ public class FollowSonePage 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.addFriend(sone); - } + currentSone.addFriend(soneId); + webInterface.getCore().saveSone(currentSone); throw new RedirectException(returnPage); } } - // - // SONETEMPLATEPAGE METHODS - // - - /** - * {@inheritDoc} - */ - @Override - protected boolean requiresLogin() { - return true; - } - }