fixed bug not displaying the http links

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/notifications@94351 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2014-04-04 13:18:26 +00:00
parent 67cdce8ef7
commit 6877631a46
2 changed files with 12 additions and 3 deletions

View File

@ -50,8 +50,8 @@ public class SingleNotificationView extends Composite {
mainPanel.addStyleName("unread-notification"); mainPanel.addStyleName("unread-notification");
} }
String notificationToShow = toShow.getDescription(); String notificationToShow = toShow.getDescription();
GWT.log(notificationToShow);
String removeMarkup = notificationToShow.replaceAll("&amp;", "&"); String removeMarkup = notificationToShow.replaceAll("&amp;", "&").replaceAll("&lt;","<").replaceAll("&gt;",">");
String actualHTML = new HTML(removeMarkup).getText(); String actualHTML = new HTML(removeMarkup).getText();
//in case of links behave differently, i know is terrible //TODO: write better code here i think //in case of links behave differently, i know is terrible //TODO: write better code here i think

View File

@ -84,6 +84,10 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No
System.out.println("SessionID = " + sessionID); System.out.println("SessionID = " + sessionID);
return SessionManager.getInstance().getASLSession(sessionID, user); return SessionManager.getInstance().getASLSession(sessionID, user);
} }
/**
* set the user in development mode
* @return
*/
public String getDevelopmentUser() { public String getDevelopmentUser() {
String user = "test.user"; String user = "test.user";
//user = "massimiliano.assante"; //user = "massimiliano.assante";
@ -125,6 +129,7 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No
try { try {
for (Notification notification : store.getAllNotificationByUser(getASLSession().getUsername(), NotificationConstants.NOTIFICATION_NUMBER_PRE)) { for (Notification notification : store.getAllNotificationByUser(getASLSession().getUsername(), NotificationConstants.NOTIFICATION_NUMBER_PRE)) {
Date dateWithoutTime = removeTimePart(notification.getTime()); Date dateWithoutTime = removeTimePart(notification.getTime());
notification.setDescription(replaceAmpersand(notification.getDescription()));
if (! toReturn.containsKey(dateWithoutTime)) { if (! toReturn.containsKey(dateWithoutTime)) {
ArrayList<Notification> nots = new ArrayList<Notification>(); ArrayList<Notification> nots = new ArrayList<Notification>();
nots.add(notification); nots.add(notification);
@ -239,7 +244,11 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No
} }
return toReturn; return toReturn;
} }
private String replaceAmpersand(String toReplace) {
String toReturn = toReplace.replaceAll("&amp;", "&");
return toReturn;
}
@Override @Override
public boolean setUserNotificationPreferences(Map<NotificationType, NotificationChannelType[]> enabledChannels) { public boolean setUserNotificationPreferences(Map<NotificationType, NotificationChannelType[]> enabledChannels) {
return store.setUserNotificationPreferences(getASLSession().getUsername(), enabledChannels); return store.setUserNotificationPreferences(getASLSession().getUsername(), enabledChannels);