- List<Notification> notifications = new ArrayList<Notification>(webInterface.getNotifications().getChangedNotifications());
- Set<Notification> removedNotifications = webInterface.getNotifications().getRemovedNotifications();
- Collections.sort(notifications, Notification.LAST_UPDATED_TIME_SORTER);
- JsonArray jsonNotifications = new JsonArray();
- for (Notification notification : notifications) {
- jsonNotifications.add(createJsonNotification(notification));
+ List<Notification> notifications = new ArrayList<Notification>(webInterface.getNotifications(currentSone));
+ Collections.sort(notifications, Notification.CREATED_TIME_SORTER);
+ /* load new posts. */
+ Collection<Post> newPosts = webInterface.getNewPosts(getCurrentSone(request.getToadletContext(), false));
+
+ ArrayNode jsonPosts = new ArrayNode(instance);
+ for (Post post : newPosts) {
+ ObjectNode jsonPost = new ObjectNode(instance);
+ jsonPost.put("id", post.getId());
+ jsonPost.put("sone", post.getSone().getId());
+ jsonPost.put("recipient", post.getRecipientId().orNull());
+ jsonPost.put("time", post.getTime());
+ jsonPosts.add(jsonPost);