updated to append the original message on mail reply

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/social-mail-servlet@120085 82a268e6-3cf1-43bd-a215-b396298e98cf
Feature/21689
Massimiliano Assante 9 years ago
parent 1939ab6cb0
commit f773e72185

@ -241,6 +241,8 @@ public class PeriodicTask implements Runnable {
recipientIds = theMessage.getAddresses();
//add the sender and remove the person who is replying from the recipients
String sender = theMessage.getSender().getPortalLogin();
String originalText = theMessage.getBody();
Date originalSentTime = theMessage.getSendTime().getTime();
recipientIds.add(sender);
recipientIds.remove(fakeSession.getUsername());
@ -248,7 +250,9 @@ public class PeriodicTask implements Runnable {
for (String rec : recipientIds) {
_log.debug(rec);
}
_log.debug("Constructing repy message");
messageText += getReplyHeaderMessage(sender, originalSentTime, originalText);
_log.debug("Trying to send message with subject: " + subject, " to: " + recipientIds.toString());
newMessageId = messageManager.sendMessageToPortalLogins(subject, messageText, new ArrayList<String>(), recipientIds);
@ -269,6 +273,18 @@ public class PeriodicTask implements Runnable {
}
}
private String getReplyHeaderMessage(String senderId, Date date, String message) {
List<String> toPass = new ArrayList<String>();
toPass.add(senderId);
List<GenericItemBean> theSender = getUsersbyUserId(toPass);
String senderFullName = senderId;
if (theSender != null && !theSender.isEmpty())
senderFullName = theSender.get(0).getAlternativeName();
String toReturn = "\n\n---\n on " + date + " " + senderFullName + " wrote:";
toReturn += "\n\n"+message;
return toReturn;
}
/**
* return the User instance given his id
* @param recipientIds

Loading…
Cancel
Save