From 4545888c01a4d7257328e7ab538b832d744aa3fd Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 13 Jul 2012 09:06:19 +0200 Subject: [PATCH] Only request status for shown Sones. This fixes #283. --- src/main/resources/static/javascript/sone.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 2063576..49f372f 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -1193,7 +1193,7 @@ function checkForRemovedReplies(oldNotification, newNotification) { } function getStatus() { - ajaxGet("getStatus.ajax", isViewSonePage() ? {"soneIds": getShownSoneId() } : {"loadAllSones": isKnownSonesPage()}, function(data, textStatus) { + ajaxGet("getStatus.ajax", isViewSonePage() ? {"soneIds": getShownSoneId() } : isKnownSonesPage() ? {"soneIds": getShownSoneIds() } : {}, function(data, textStatus) { if ((data != null) && data.success) { /* process Sone information. */ $.each(data.sones, function(index, value) { @@ -1359,6 +1359,20 @@ function getShownSoneId() { } /** + * Returns the ID of all currently visible Sones. This is mainly used on the + * “Known Sones” page. + * + * @returns The ID of the currently shown Sones + */ +function getShownSoneIds() { + var soneIds = new Array(); + $("#sone #known-sones .sone .id").each(function() { + soneIds.push($(this).text()); + }); + return soneIds.join(","); +} + +/** * Returns whether the current page is a “view post” page. * * @returns {Boolean} true if the current page is a “view post” -- 2.7.4