Store friend Sones as strings, not as Sone objects.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / ajax / FollowSoneAjaxPage.java
index 0c83553..6d98b43 100644 (file)
@@ -44,15 +44,14 @@ public class FollowSoneAjaxPage extends JsonPage {
        @Override
        protected JsonObject createJsonObject(Request request) {
                String soneId = request.getHttpRequest().getParam("sone");
-               Sone sone = webInterface.getCore().getSone(soneId);
-               if (sone == null) {
+               if (!webInterface.getCore().hasSone(soneId)) {
                        return new JsonObject().put("success", false).put("error", "invalid-sone-id");
                }
                Sone currentSone = getCurrentSone(request.getToadletContext());
                if (currentSone == null) {
                        return new JsonObject().put("success", false).put("error", "auth-required");
                }
-               currentSone.addFriend(sone);
+               currentSone.addFriend(soneId);
                webInterface.getCore().saveSone(currentSone);
                return new JsonObject().put("success", true);
        }