X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FGetStatusAjaxPage.java;h=09b6f40758b0a480845db6eac73b9e6649fe5443;hb=7a24783f89a56c8570b3efc010561e02430c097f;hp=b28b82e97b0caedbb75b96b2069e3ab869991834;hpb=00271cc31bb7f28d4917a54d384aff58983f0a07;p=Sone.git 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..09b6f40 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java @@ -19,7 +19,6 @@ package net.pterodactylus.sone.web.ajax; import java.text.DateFormat; import java.text.SimpleDateFormat; -import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashSet; @@ -66,10 +65,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) { @@ -80,7 +88,7 @@ public class GetStatusAjaxPage extends JsonPage { jsonSones.add(jsonSone); } /* load notifications. */ - List notifications = ListNotificationFilters.filterNotifications(new ArrayList(webInterface.getNotifications().getNotifications()), currentSone); + List notifications = ListNotificationFilters.filterNotifications(webInterface.getNotifications().getNotifications(), currentSone); Collections.sort(notifications, Notification.LAST_UPDATED_TIME_SORTER); JsonArray jsonNotificationInformations = new JsonArray(); for (Notification notification : notifications) {