mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (4.3/Cloud)
73072: Merged V4.2-BUG-FIX (4.2.3) to HEAD-BUG-FIX (4.3/Cloud) 72995: MNT-11488: Merged DEV to V4.2-BUG-FIX (4.2.3) 71868: MNT-11488: Duplicate notification when notification rule set for multiple users - Fix MailActionExecuter to send bulk message to all recipients only one time if template was not defined for rule. Add unit test for case. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@74755 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -201,6 +201,7 @@ public class MailActionExecuter extends ActionExecuterAbstractBase
|
||||
*/
|
||||
private boolean testMode = false;
|
||||
private MimeMessage lastTestMessage;
|
||||
private int testSentCount;
|
||||
|
||||
private TemplateImageResolver imageResolver;
|
||||
|
||||
@@ -519,6 +520,16 @@ public class MailActionExecuter extends ActionExecuterAbstractBase
|
||||
|
||||
private MimeMessageHelper[] prepareEmails(final Action ruleAction, final NodeRef actionedUponNodeRef)
|
||||
{
|
||||
Serializable ref = ruleAction.getParameterValue(PARAM_TEMPLATE);
|
||||
String templateRef = (ref instanceof NodeRef ? ((NodeRef)ref).toString() : (String)ref);
|
||||
if (templateRef == null)
|
||||
{
|
||||
// send as bulk message if there is no template
|
||||
MimeMessageHelper[] messages = new MimeMessageHelper[1];
|
||||
messages[0] = prepareEmail(ruleAction, actionedUponNodeRef, null, null);
|
||||
return messages;
|
||||
}
|
||||
|
||||
List<Pair<String, Locale>> recipients = getRecipients(ruleAction);
|
||||
|
||||
Pair<InternetAddress, Locale> from = getFrom(ruleAction);
|
||||
@@ -941,6 +952,7 @@ public class MailActionExecuter extends ActionExecuterAbstractBase
|
||||
else
|
||||
{
|
||||
lastTestMessage = preparedMessage.getMimeMessage();
|
||||
testSentCount++;
|
||||
}
|
||||
}
|
||||
catch (MailException e)
|
||||
@@ -1479,6 +1491,16 @@ public class MailActionExecuter extends ActionExecuterAbstractBase
|
||||
return lastTestMessage;
|
||||
}
|
||||
|
||||
public int getTestSentCount()
|
||||
{
|
||||
return testSentCount;
|
||||
}
|
||||
|
||||
public int resetTestSentCount()
|
||||
{
|
||||
return testSentCount = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used when test mode is enabled.
|
||||
* Clears the record of the last message that was sent.
|
||||
|
Reference in New Issue
Block a user