From: David ‘Bombe’ Roden Date: Fri, 6 May 2011 23:25:33 +0000 (+0200) Subject: Update Sone on “view Sone” page, too. X-Git-Tag: 0.6.4^2~13 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=694ab9e6059ad2db8e72efc01b9acddf89bb3fa3;p=Sone.git Update Sone on “view Sone” page, too. This fixes #156. --- 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 b28b82e..4e2049e 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java @@ -66,10 +66,19 @@ public class GetStatusAjaxPage extends JsonPage { protected JsonObject createJsonObject(Request request) { final Sone currentSone = getCurrentSone(request.getToadletContext(), false); /* load Sones. */ - boolean loadAllSones = Boolean.parseBoolean(request.getHttpRequest().getParam("loadAllSones", "true")); + boolean loadAllSones = Boolean.parseBoolean(request.getHttpRequest().getParam("loadAllSones", "false")); Set sones = new HashSet(Collections.singleton(getCurrentSone(request.getToadletContext(), false))); if (loadAllSones) { sones.addAll(webInterface.getCore().getSones()); + } else { + String loadSoneIds = request.getHttpRequest().getParam("soneIds"); + if (loadSoneIds.length() > 0) { + String[] soneIds = loadSoneIds.split(","); + for (String soneId : soneIds) { + /* just add it, we skip null further down. */ + sones.add(webInterface.getCore().getSone(soneId, false)); + } + } } JsonArray jsonSones = new JsonArray(); for (Sone sone : sones) { diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index d21e6c6..838b669 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -978,7 +978,7 @@ function checkForRemovedReplies(oldNotification, newNotification) { } function getStatus() { - $.getJSON("getStatus.ajax", {"loadAllSones": isKnownSonesPage()}, function(data, textStatus) { + $.getJSON("getStatus.ajax", isViewSonePage() ? {"soneIds": getShownSoneId() } : {"loadAllSones": isKnownSonesPage()}, function(data, textStatus) { if ((data != null) && data.success) { /* process Sone information. */ $.each(data.sones, function(index, value) {