X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FGetNotificationsAjaxPage.java;h=6573ddacf23b76fb289ca072923aebb3ad0c1ad6;hb=274784c1ae880b7cdc2bb7cf31d75e4092ec5653;hp=4e9a879dd748ddb712f1999b0b758667bed98832;hpb=a47643aed43d118ca68044f95451bb5374cdb332;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/GetNotificationsAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/GetNotificationsAjaxPage.java index 4e9a879..6573dda 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/GetNotificationsAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/GetNotificationsAjaxPage.java @@ -1,5 +1,5 @@ /* - * Sone - GetNotificationsAjaxPage.java - Copyright © 2011–2012 David Roden + * Sone - GetNotificationsAjaxPage.java - Copyright © 2011–2013 David Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,7 +32,6 @@ import net.pterodactylus.util.json.JsonArray; import net.pterodactylus.util.json.JsonObject; import net.pterodactylus.util.notify.Notification; import net.pterodactylus.util.notify.TemplateNotification; -import net.pterodactylus.util.object.HashCode; import net.pterodactylus.util.template.TemplateContext; /** @@ -81,12 +80,11 @@ public class GetNotificationsAjaxPage extends JsonPage { Collection notifications = webInterface.getNotifications().getNotifications(); List filteredNotifications = ListNotificationFilters.filterNotifications(notifications, currentSone); Collections.sort(filteredNotifications, Notification.CREATED_TIME_SORTER); - int notificationHash = HashCode.hashCode(filteredNotifications); JsonArray jsonNotifications = new JsonArray(); for (Notification notification : filteredNotifications) { jsonNotifications.add(createJsonNotification(request, notification)); } - return createSuccessJsonObject().put("notificationHash", notificationHash).put("notifications", jsonNotifications).put("options", createJsonOptions(currentSone)); + return createSuccessJsonObject().put("notificationHash", filteredNotifications.hashCode()).put("notifications", jsonNotifications).put("options", createJsonOptions(currentSone)); } // @@ -142,7 +140,7 @@ public class GetNotificationsAjaxPage extends JsonPage { * The current Sone (may be {@code null}) * @return The current options */ - private JsonObject createJsonOptions(Sone currentSone) { + private static JsonObject createJsonOptions(Sone currentSone) { JsonObject options = new JsonObject(); if (currentSone != null) { options.put("ShowNotification/NewSones", currentSone.getOptions().getBooleanOption("ShowNotification/NewSones").get());