X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FMarkAsKnownAjaxPage.java;h=fb602db0eaa3d2e1665a6b98810ce34c30889c06;hb=2e03e9dddbea4b81aacaf1aa316f5c3ccffd4bf9;hp=6610971ab49b7d2f8fb694cf3d76f87432fc0370;hpb=6f019de1d4d9742981d851ac3c9097cca8bff58e;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/MarkAsKnownAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/MarkAsKnownAjaxPage.java index 6610971..fb602db 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/MarkAsKnownAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/MarkAsKnownAjaxPage.java @@ -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; @@ -46,11 +45,8 @@ public class MarkAsKnownAjaxPage extends JsonPage { super("markAsKnown.ajax", webInterface); } - /** - * {@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"); @@ -59,17 +55,17 @@ public class MarkAsKnownAjaxPage extends JsonPage { Core core = webInterface.getCore(); for (String id : ids) { if (type.equals("post")) { - Optional post = core.getPost(id); + Optional post = core.getDatabase().getPost(id); if (!post.isPresent()) { continue; } core.markPostKnown(post.get()); } else if (type.equals("reply")) { - Optional reply = core.getPostReply(id); + Optional reply = core.getDatabase().getPostReply(id); if (!reply.isPresent()) { continue; } - core.markReplyKnown(reply.get()); + reply.get().modify().setKnown().update(webInterface.getCore().postReplyUpdated()); } else if (type.equals("sone")) { Optional sone = core.getSone(id); if (!sone.isPresent()) { @@ -81,9 +77,6 @@ public class MarkAsKnownAjaxPage extends JsonPage { return createSuccessJsonObject(); } - /** - * {@inheritDoc} - */ @Override protected boolean requiresLogin() { return false;