- return createSuccessJsonObject().put("sones", jsonSones).put("notifications", jsonNotifications).put("removedNotifications", jsonRemovedNotifications).put("newPosts", jsonPosts).put("newReplies", jsonReplies);
+ /* remove replies to unknown posts. */
+ newReplies = Collections2.filter(newReplies, PostReply.HAS_POST_FILTER);
+ ArrayNode jsonReplies = new ArrayNode(instance);
+ for (PostReply reply : newReplies) {
+ ObjectNode jsonReply = new ObjectNode(instance);
+ jsonReply.put("id", reply.getId());
+ jsonReply.put("sone", reply.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);