Allow method chaining in Profile.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / FollowSonePage.java
index 2e9f2fe..3729768 100644 (file)
@@ -18,7 +18,6 @@
 package net.pterodactylus.sone.web;
 
 import net.pterodactylus.sone.data.Sone;
-import net.pterodactylus.sone.data.SoneShell;
 import net.pterodactylus.util.template.Template;
 
 /**
@@ -49,10 +48,10 @@ 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());
-                       currentSone.addFriendSone(sone);
+               if (!sone.equals(currentSone)) {
+                       currentSone.addFriend(sone);
                }
                throw new RedirectException("viewSone.html?sone=" + soneId);
        }