Don’t let a Sone follow itself!
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 15 Oct 2010 07:39:48 +0000 (09:39 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 15 Oct 2010 07:39:48 +0000 (09:39 +0200)
src/main/java/net/pterodactylus/sone/web/FollowSonePage.java

index 2e9f2fe..39e08f3 100644 (file)
@@ -49,9 +49,9 @@ public class FollowSonePage extends SoneTemplatePage {
        protected void processTemplate(Request request, Template template) throws RedirectException {
                super.processTemplate(request, template);
                String soneId = request.getHttpRequest().getParam("sone");
+               Sone currentSone = getCurrentSone(request.getToadletContext());
                Sone sone = webInterface.core().getSone(soneId);
-               if (!(sone instanceof SoneShell)) {
-                       Sone currentSone = getCurrentSone(request.getToadletContext());
+               if (!(sone instanceof SoneShell) && !sone.equals(currentSone)) {
                        currentSone.addFriendSone(sone);
                }
                throw new RedirectException("viewSone.html?sone=" + soneId);