From 2288fe8a74e888e9d6a8b13ccbd322ca006c1cec Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 13 Jan 2011 14:56:07 +0100 Subject: [PATCH] Return IDs of Sone and recipient when getting new posts. --- .../java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java | 6 +++++- src/main/resources/static/javascript/sone.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) 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 015add5..effbebe 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java @@ -91,7 +91,11 @@ public class GetStatusAjaxPage extends JsonPage { Set newPosts = webInterface.getNewPosts(); JsonArray jsonPosts = new JsonArray(); for (Post post : newPosts) { - jsonPosts.add(post.getId()); + 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); + jsonPosts.add(jsonPost); } /* load new replies. */ Set newReplies = webInterface.getNewReplies(); diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 2c3f742..c9521b7 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -585,7 +585,7 @@ function getStatus() { }); /* process new posts. */ $.each(data.newPosts, function(index, value) { - loadNewPost(value); + loadNewPost(value.id, value.sone, value.recipient); }); /* process new replies. */ $.each(data.newReplies, function(index, value) { -- 2.7.4