Include notification hash code in the template.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 24 Nov 2011 09:29:48 +0000 (10:29 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 24 Nov 2011 09:29:48 +0000 (10:29 +0100)
src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java
src/main/resources/templates/include/head.html

index 095db9e..3218b58 100644 (file)
@@ -31,6 +31,8 @@ import net.pterodactylus.sone.web.page.FreenetRequest;
 import net.pterodactylus.sone.web.page.FreenetTemplatePage;
 import net.pterodactylus.util.collection.ListBuilder;
 import net.pterodactylus.util.collection.MapBuilder;
+import net.pterodactylus.util.notify.Notification;
+import net.pterodactylus.util.object.HashCode;
 import net.pterodactylus.util.template.Template;
 import net.pterodactylus.util.template.TemplateContext;
 import freenet.clients.http.SessionManager.Session;
@@ -259,7 +261,9 @@ public class SoneTemplatePage extends FreenetTemplatePage {
                templateContext.set("latestEdition", webInterface.getCore().getUpdateChecker().getLatestEdition());
                templateContext.set("latestVersion", webInterface.getCore().getUpdateChecker().getLatestVersion());
                templateContext.set("latestVersionTime", webInterface.getCore().getUpdateChecker().getLatestVersionDate());
-               templateContext.set("notifications", ListNotificationFilters.filterNotifications(webInterface.getNotifications().getNotifications(), currentSone));
+               List<Notification> notifications = ListNotificationFilters.filterNotifications(webInterface.getNotifications().getNotifications(), currentSone);
+               templateContext.set("notifications", notifications);
+               templateContext.set("notificationHash", HashCode.hashCode(notifications));
        }
 
        /**
index cd9eddf..734697a 100644 (file)
@@ -15,6 +15,8 @@
 
                <div id="notification-area">
 
+                       <div id="notification-hash" class="hidden"><%= notificationHash|html></div>
+
                        <form id="notification-dismiss-template" class="hidden dismiss" action="dismissNotification.html" method="post">
                                <input type="hidden" name="formPassword" value="<% formPassword|html>" />
                                <input type="hidden" name="returnPage" value="<% request.uri|html>" />