diff --git a/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/SingleNotificationView.java b/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/SingleNotificationView.java index b73e8de..91c78ef 100644 --- a/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/SingleNotificationView.java +++ b/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/SingleNotificationView.java @@ -29,8 +29,6 @@ public class SingleNotificationView extends Composite { NotificationImages images = GWT.create(NotificationImages.class); - private Notification myNotification; - @UiField Image notificationImage; @UiField HTMLPanel mainPanel; @@ -40,7 +38,10 @@ public class SingleNotificationView extends Composite { public SingleNotificationView(Notification toShow) { initWidget(uiBinder.createAndBindUi(this)); - myNotification = toShow; + + if (!toShow.isRead()) { + mainPanel.addStyleName("unread-notification"); + } String notificationToShow = toShow.getDescription(); String removeMarkup = notificationToShow.replaceAll("&", "&"); @@ -49,7 +50,6 @@ public class SingleNotificationView extends Composite { //in case of links behave differently, i know is terrible //TODO: write better code here i think if (new HTML(actualHTML).getText().equalsIgnoreCase(LINK_TEXT)) { - GWT.log("E' UN LINK!"); actualHTML = actualHTML.replace("your post:", ""); actualHTML = actualHTML.replace("shared", ""); actualHTML = actualHTML.replace("link.", "link"); @@ -68,6 +68,8 @@ public class SingleNotificationView extends Composite { switch (toShow.getType()) { case DOCUMENT_WORKFLOW_STEP_REQUEST_TASK: goApp.setHTML(" See this Document Workflow."); + //remove the Sender of the notification because it is sent by the user that performs the last forward + notificationText.setHTML(actualHTML); break; case DOCUMENT_WORKFLOW_FIRST_STEP_REQUEST_INVOLVMENT: goApp.setHTML(" See this New Document Workflow."); diff --git a/src/main/java/org/gcube/portlets/user/notifications/server/NotificationsServiceImpl.java b/src/main/java/org/gcube/portlets/user/notifications/server/NotificationsServiceImpl.java index 21512c6..150d658 100644 --- a/src/main/java/org/gcube/portlets/user/notifications/server/NotificationsServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/notifications/server/NotificationsServiceImpl.java @@ -59,8 +59,8 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No String user = (String) this.getThreadLocalRequest().getSession().getAttribute(ScopeHelper.USERNAME_ATTRIBUTE); if (user == null) { //user = "test.user"; - user = "leonardo.candela"; - + //user = "leonardo.candela"; + user = "massimiliano.assante"; _log.warn("USER IS NULL setting "+user+" and Running OUTSIDE PORTAL"); withinPortal = false; } @@ -148,13 +148,11 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No return cal.getTime(); } /** - * this set all the notifications for this user read + * this sets all the notifications for this user read */ public boolean setAllUserNotificationsRead() { try { - for (Notification notification :store.getUnreadNotificationsByUser(getASLSession().getUsername()) ) { - store.setNotificationRead(notification.getKey()); - } + store.setAllNotificationReadByUser(getASLSession().getUsername()); } catch (Exception e) { _log.error("While trying to set User notifications Read"); e.printStackTrace(); diff --git a/src/main/webapp/Notifications.css b/src/main/webapp/Notifications.css index 850ed2e..4489a39 100644 --- a/src/main/webapp/Notifications.css +++ b/src/main/webapp/Notifications.css @@ -43,6 +43,11 @@ a.link:hover { border-top: 1px solid #EFEFEF; } + +.unread-notification { + background-color: #e8effa; +} + .no-notification-message { line-height: 40px; font-family: 'Architects Daughter', arial, sans-serif;