Get the notifications from the web interface.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 14 Nov 2010 16:11:29 +0000 (17:11 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 14 Nov 2010 16:11:29 +0000 (17:11 +0100)
src/main/java/net/pterodactylus/sone/web/DismissNotificationPage.java
src/main/java/net/pterodactylus/sone/web/ajax/DismissNotificationAjaxPage.java
src/main/resources/templates/include/head.html

index bdbf008..4981afb 100644 (file)
@@ -50,9 +50,9 @@ public class DismissNotificationPage extends SoneTemplatePage {
        protected void processTemplate(Request request, Template template) throws RedirectException {
                super.processTemplate(request, template);
                String notificationId = request.getHttpRequest().getPartAsStringFailsafe("notification", 36);
-               Notification notification = webInterface.getCore().getNotifications().getNotification(notificationId);
+               Notification notification = webInterface.getNotifications().getNotification(notificationId);
                if ((notification != null) && notification.isDismissable()) {
-                       webInterface.getCore().getNotifications().removeNotification(notification);
+                       notification.dismiss();
                }
                String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 64);
                throw new RedirectException(returnPage);
index a098e46..44171e3 100644 (file)
@@ -44,14 +44,14 @@ public class DismissNotificationAjaxPage extends JsonPage {
        @Override
        protected JsonObject createJsonObject(Request request) {
                String notificationId = request.getHttpRequest().getParam("notification");
-               Notification notification = webInterface.getCore().getNotifications().getNotification(notificationId);
+               Notification notification = webInterface.getNotifications().getNotification(notificationId);
                if (notification == null) {
                        return createErrorJsonObject("invalid-notification-id");
                }
                if (!notification.isDismissable()) {
                        return createErrorJsonObject("not-dismissable");
                }
-               webInterface.getCore().getNotifications().removeNotification(notification);
+               notification.dismiss();
                return createSuccessJsonObject();
        }
 
index 75485bf..2802d4e 100644 (file)
                <%/if>
 
                <div id="notification-area">
-                       <%foreach webInterface.core.notifications.all notification>
+                       <%foreach webInterface.notifications.all notification>
                                <div class="notification" id="<% notification.id|html>">
                                        <%if notification.dismissable>
                                                <form class="dismiss" action="dismissNotification.html" method="post">