Use local Sones in more places where it’s appropriate.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / ajax / FollowSoneAjaxPage.java
index 64c402a..c394326 100644 (file)
@@ -19,6 +19,7 @@ package net.pterodactylus.sone.web.ajax;
 
 import com.google.common.base.Optional;
 
+import net.pterodactylus.sone.data.LocalSone;
 import net.pterodactylus.sone.data.Sone;
 import net.pterodactylus.sone.web.WebInterface;
 import net.pterodactylus.sone.web.page.FreenetRequest;
@@ -50,10 +51,7 @@ public class FollowSoneAjaxPage extends JsonPage {
                if (!sone.isPresent()) {
                        return createErrorJsonObject("invalid-sone-id");
                }
-               Sone currentSone = getCurrentSone(request.getToadletContext());
-               if (currentSone == null) {
-                       return createErrorJsonObject("auth-required");
-               }
+               LocalSone currentSone = getCurrentSone(request.getToadletContext()).get();
                webInterface.getCore().followSone(currentSone, soneId);
                webInterface.getCore().markSoneKnown(sone.get());
                return createSuccessJsonObject();