From: David ‘Bombe’ Roden Date: Sun, 14 Nov 2010 16:11:29 +0000 (+0100) Subject: Get the notifications from the web interface. X-Git-Tag: 0.3-RC1~71 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=561524ab3db17469dddbd7d5ca3ffd8495a0b7a3 Get the notifications from the web interface. --- diff --git a/src/main/java/net/pterodactylus/sone/web/DismissNotificationPage.java b/src/main/java/net/pterodactylus/sone/web/DismissNotificationPage.java index bdbf008..4981afb 100644 --- a/src/main/java/net/pterodactylus/sone/web/DismissNotificationPage.java +++ b/src/main/java/net/pterodactylus/sone/web/DismissNotificationPage.java @@ -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); diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/DismissNotificationAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/DismissNotificationAjaxPage.java index a098e46..44171e3 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/DismissNotificationAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/DismissNotificationAjaxPage.java @@ -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(); } diff --git a/src/main/resources/templates/include/head.html b/src/main/resources/templates/include/head.html index 75485bf..2802d4e 100644 --- a/src/main/resources/templates/include/head.html +++ b/src/main/resources/templates/include/head.html @@ -214,7 +214,7 @@ <%/if>
- <%foreach webInterface.core.notifications.all notification> + <%foreach webInterface.notifications.all notification>
<%if notification.dismissable>