Don’t set friends directly, use Core’s follow() methods.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / FollowSonePage.java
index 143e0ba..4083b99 100644 (file)
@@ -55,9 +55,11 @@ public class FollowSonePage extends SoneTemplatePage {
                        Sone currentSone = getCurrentSone(request.getToadletContext());
                        String soneIds = request.getHttpRequest().getPartAsStringFailsafe("sone", 1200);
                        for (String soneId : soneIds.split("[ ,]+")) {
-                               currentSone.addFriend(soneId);
+                               if (webInterface.getCore().hasSone(soneId)) {
+                                       webInterface.getCore().followSone(currentSone, soneId);
+                                       webInterface.getCore().markSoneKnown(webInterface.getCore().getSone(soneId));
+                               }
                        }
-                       webInterface.getCore().touchConfiguration();
                        throw new RedirectException(returnPage);
                }
        }