From 561524ab3db17469dddbd7d5ca3ffd8495a0b7a3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 14 Nov 2010 17:11:29 +0100 Subject: [PATCH] Get the notifications from the web interface. --- src/main/java/net/pterodactylus/sone/web/DismissNotificationPage.java | 4 ++-- .../net/pterodactylus/sone/web/ajax/DismissNotificationAjaxPage.java | 4 ++-- src/main/resources/templates/include/head.html | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) 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>
-- 2.7.4