diff --git a/.classpath b/.classpath index 1729369..2c1d80c 100644 --- a/.classpath +++ b/.classpath @@ -8,6 +8,7 @@ + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 443e085..8db228c 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -5,4 +5,5 @@ org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.release=disabled org.eclipse.jdt.core.compiler.source=1.7 diff --git a/distro/changelog.xml b/distro/changelog.xml index 5e211d7..6a07dd5 100644 --- a/distro/changelog.xml +++ b/distro/changelog.xml @@ -1,4 +1,8 @@ + + Bug #16725, Social networking: emails notification + Feature #12613, Replace use of "$" character with "_" when sending notification emails about posts and messages diff --git a/pom.xml b/pom.xml index d91d6d1..955c9eb 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.gcube.applicationsupportlayer aslsocial - 1.5.0-SNAPSHOT + 1.6.0-SNAPSHOT jar Social Portal ASL Extension diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/mailing/SocialMailingUtil.java b/src/main/java/org/gcube/applicationsupportlayer/social/mailing/SocialMailingUtil.java index 1bc2170..c87a638 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/mailing/SocialMailingUtil.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/mailing/SocialMailingUtil.java @@ -54,17 +54,10 @@ public class SocialMailingUtil { List comments, String commentKey, String ... hashtags) { + String removedMarkup = notification2Save.getDescription().replaceAll("&", "&"); - if (hashtags != null && hashtags.length > 0) { - _log.debug("editing hyperlinks for mail client"); - //notification2Save uri contains the absoulte path to the feed in the correct channel, e.g. /group/ustore_vre?oid=f1637958-34d0-48fc-b5ad-13b1116e389d - String pathToVRE = siteLandingPagePath + "?"; - if (notification2Save.getUri().split("\\?").length > 0) { - pathToVRE = notification2Save.getUri().split("\\?")[0]; - } - removedMarkup = removedMarkup.replace("href=\"?", "href=\""+portalURL + pathToVRE + "?"); //because there is no indication of the portal - } - + removedMarkup = convertHTML2Text(removedMarkup); + removedMarkup = removedMarkup.replaceAll("(\r\n|\n)","
"); //preserve new lines String sender = notification2Save.getSenderFullName(); String portalHost = portalURL.replaceAll("https://", ""); @@ -93,7 +86,9 @@ public class SocialMailingUtil { body.append("
") .append("

").append(sender).append(" ").append(removedMarkup) // has done something + .append("

") .append(getActionLink(notification2Save, portalURL)) //Goto + .append("

") .append(attachmentsNotice) .append(SocialMailingUtil.buildHtmlDiscussion(notification2Save, feed, comments, commentKey)) // the original discussion .append("

") @@ -378,6 +373,13 @@ public class SocialMailingUtil { private static StringBuffer buildStringFromNode(Node node) { StringBuffer buffer = new StringBuffer(); + if (node instanceof Element) { + Element element = (Element) node; + if ("a".equals(element.tagName())) { + buffer.append(" "); + } + } + if (node instanceof TextNode) { TextNode textNode = (TextNode) node; buffer.append(textNode.text().trim()); @@ -390,11 +392,13 @@ public class SocialMailingUtil { if (node instanceof Element) { Element element = (Element) node; String tagName = element.tagName(); + if ("a".equals(element.tagName())) { + buffer.append(" "); + } if ("p".equals(tagName) || "br".equals(tagName)) { buffer.append("\n"); } } - return buffer; } @@ -421,7 +425,7 @@ public class SocialMailingUtil { // escape html String feedTextNoHtml = convertHTML2Text(feed.getDescription()); - + feedTextNoHtml = feedTextNoHtml.replaceAll("(\r\n|\n)","
"); //preserve new lines // build up html post + comments if(notification2Save.getType() == NotificationType.POST_ALERT || (comments.size() == 0 && notification2Save.getType() == NotificationType.MENTION)) htmlPost += "
"); //preserve new lines + if((commentKey != null && comments.get(i).getKey().equals(commentKey)) && !(notification2Save.getType() == NotificationType.POST_ALERT)){ htmlPost += "
" @@ -473,7 +479,7 @@ public class SocialMailingUtil { + "white-space: nowrap; font-size: smaller; color: #999;\">" + formatter.format(comments.get(i).getTime()) + "

" +"
"; } - + _log.debug("***buildHtmlDiscussion returning=\n"+htmlPost); return htmlPost; } }catch(Exception e){