Use Jackson to create JSON pages, get rid of utils-json dependency.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / ajax / MarkAsKnownAjaxPage.java
index 997c9dc..cd026ef 100644 (file)
@@ -24,7 +24,6 @@ import net.pterodactylus.sone.data.Reply;
 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;
 
 import com.google.common.base.Optional;
 
@@ -50,7 +49,7 @@ public class MarkAsKnownAjaxPage extends JsonPage {
         * {@inheritDoc}
         */
        @Override
-       protected JsonObject createJsonObject(FreenetRequest request) {
+       protected JsonReturnObject createJsonObject(FreenetRequest request) {
                String type = request.getHttpRequest().getParam("type");
                if (!type.equals("sone") && !type.equals("post") && !type.equals("reply")) {
                        return createErrorJsonObject("invalid-type");
@@ -71,11 +70,11 @@ public class MarkAsKnownAjaxPage extends JsonPage {
                                }
                                core.markReplyKnown(reply.get());
                        } else if (type.equals("sone")) {
-                               Sone sone = core.getSone(id, false);
-                               if (sone == null) {
+                               Optional<Sone> sone = core.getSone(id);
+                               if (!sone.isPresent()) {
                                        continue;
                                }
-                               core.markSoneKnown(sone);
+                               core.markSoneKnown(sone.get());
                        }
                }
                return createSuccessJsonObject();