- JsonArray jsonRemovedNotifications = new JsonArray();
- for (Notification notification : removedNotifications) {
- jsonRemovedNotifications.add(createJsonNotification(notification));
+ /* load new replies. */
+ Set<PostReply> newReplies = webInterface.getNewReplies();
+ if (currentSone != null) {
+ newReplies = Filters.filteredSet(newReplies, new Filter<PostReply>() {
+
+ @Override
+ public boolean filterObject(PostReply reply) {
+ return ListNotificationFilters.isReplyVisible(currentSone, reply);
+ }
+
+ });
+ }
+ /* remove replies to unknown posts. */
+ newReplies = Filters.filteredSet(newReplies, new Filter<PostReply>() {
+
+ @Override
+ public boolean filterObject(PostReply reply) {
+ return (reply.getPost() != null) && (reply.getPost().getSone() != null);
+ }
+ });
+ 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());
+ jsonReplies.add(jsonReply);