Inhibiting notifications to certain users



JEMH identifies the non-jira senders as well as all email recipients (To and CC). Sometimes there might be cases where you only want to inform the CC about specific events and this functionality can only be obtained by inhibiting the notification (scripting). 



Set up for storing sender email address and email participants address in custom fields. The specific trick here for stopping the reporter getting updates outside of issue created is achievable only if some specific scripting is added to all enabled non-jira templates.
In the specific cases of interactive users adding a comment ONLY (not doing an issue edit), you can enable the Issue Commented event in the JEMH Event Listener to limit any other notifications. The restriction that you would want to remove the reporter from the comment list is achieved by detecting the reporter as the current recipient (email content is rendered per recipient) is described in: 
Prevent /inhibit sending of a notification (Issue Event or Postfunction)

#if ( (! $!recipientUser) && $!recipientEmail && $!issue.getCustomFieldValue("customfield_10205")) <prev> Going to compare... </prev> #if ( $issue.getCustomFieldValue("customfield_10205").equalsIgnoreCase($recipientEmail) ) <prev> Inhibiting... </prev> $jemhUtils.setInhibitSending(true) $jemhUtils.setInhibitSendingReason("Reporter is inhibited from receiving notification") #end #else <prev> Failed to compare... </prev> #end

This script has been designed to remove the reporter from being notified when a new comment has been added. However, you can adapt this approach to accommodate your requirements which is to remove the all email recipients (To and CC) from the notification of Issue Created and by selecting the Template Sets which you would've created using your own script.

Inhibiting Text Multi-Line Fields

As with the script above inhibition is used to prevent notifications to a specific user, however the following script shows how to inhibit notifications for multiple addresses in a single custom field.

 

#set($ccRecipientCFid = "customfield_10200") #set($ccRecipientCFVal = $!issue.getCustomFieldValue($ccRecipientCFid)) #if($ccRecipientCFVal) #set($ccRecipientList = $ccRecipientCFVal.split(",")) #foreach($ccRecipient in $ccRecipientList) #if (!$recipientUser && $recipientEmail) #if ($ccRecipient.trim().equalsIgnoreCase($recipientEmail.trim())) $jemhUtils.setInhibitSending(true) $jemhUtils.setInhibitSendingReason("CC participant is inhibited from receiving notification") #end #end #end #end