X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FGetStatusAjaxPage.java;h=48b25d66430d42adf98313682d3424314a52d723;hb=45803a1c678d6811f7bbf85d50c79844031be0f0;hp=384261c0f76cdc337da6e83c827cac508526606d;hpb=7f024734546973cd592e6cbf04604705477f15f6;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java index 384261c..48b25d6 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java @@ -74,7 +74,7 @@ public class GetStatusAjaxPage extends JsonPage { String[] soneIds = loadSoneIds.split(","); for (String soneId : soneIds) { /* just add it, we skip null further down. */ - sones.add(webInterface.getCore().getSone(soneId)); + sones.add(webInterface.getCore().getSone(soneId).orNull()); } } JsonArray jsonSones = new JsonArray(); @@ -105,7 +105,7 @@ public class GetStatusAjaxPage extends JsonPage { JsonObject jsonPost = new JsonObject(); jsonPost.put("id", post.getId()); jsonPost.put("sone", post.getSone().getId()); - jsonPost.put("recipient", (post.getRecipient() != null) ? post.getRecipient().getId() : null); + jsonPost.put("recipient", post.getRecipientId().orNull()); jsonPost.put("time", post.getTime()); jsonPosts.add(jsonPost); } @@ -122,20 +122,14 @@ public class GetStatusAjaxPage extends JsonPage { }); } /* remove replies to unknown posts. */ - newReplies = Collections2.filter(newReplies, new Predicate() { - - @Override - public boolean apply(PostReply reply) { - return (reply.getPost() != null) && (reply.getPost().getSone() != null); - } - }); + newReplies = Collections2.filter(newReplies, PostReply.HAS_POST_FILTER); JsonArray jsonReplies = new JsonArray(); for (PostReply reply : newReplies) { JsonObject jsonReply = new JsonObject(); jsonReply.put("id", reply.getId()); jsonReply.put("sone", reply.getSone().getId()); - jsonReply.put("post", reply.getPost().getId()); - jsonReply.put("postSone", reply.getPost().getSone().getId()); + jsonReply.put("post", reply.getPostId()); + jsonReply.put("postSone", reply.getPost().get().getSone().getId()); jsonReplies.add(jsonReply); } return createSuccessJsonObject().put("loggedIn", currentSone != null).put("options", createJsonOptions(currentSone)).put("sones", jsonSones).put("notificationHash", notifications.hashCode()).put("newPosts", jsonPosts).put("newReplies", jsonReplies);