Return an optional Sone from the current session.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / ajax / LikeAjaxPage.java
index 6787711..e7574a5 100644 (file)
@@ -21,7 +21,6 @@ import net.pterodactylus.sone.data.Post;
 import net.pterodactylus.sone.data.Sone;
 import net.pterodactylus.sone.web.WebInterface;
 import net.pterodactylus.sone.web.page.FreenetRequest;
-import net.pterodactylus.util.json.JsonObject;
 
 /**
  * AJAX page that lets the user like a {@link Post}.
@@ -44,13 +43,13 @@ public class LikeAjaxPage extends JsonPage {
         * {@inheritDoc}
         */
        @Override
-       protected JsonObject createJsonObject(FreenetRequest request) {
+       protected JsonReturnObject createJsonObject(FreenetRequest request) {
                String type = request.getHttpRequest().getParam("type", null);
                String id = request.getHttpRequest().getParam(type, null);
                if ((id == null) || (id.length() == 0)) {
                        return createErrorJsonObject("invalid-" + type + "-id");
                }
-               Sone currentSone = getCurrentSone(request.getToadletContext());
+               Sone currentSone = getCurrentSone(request.getToadletContext()).get();
                if (currentSone == null) {
                        return createErrorJsonObject("auth-required");
                }