Render All Comments from Issue

This script will gather and render all comments that the recipient has permission to view. e.g. Internal Comments are not rendered for Customers.

#set ( $comments = $jemhUtils.filterRestrictedComments($context.issue.fields.comment.comments) ) #if ( $comments.size() > 0 ) $jemhUtils.setCommentRendered() #end #foreach ($aComment in $comments) <strong>$jemhUtils.getUserDescription($aComment.author)</strong> <em>$aComment.updated.asText():</em> <p>$jemhUtils.wikiToHtml($aComment.body.asText())</p> #end

Screenshot of how the comments would appear within the notification

image-20240124-112425.png

Previous Comments with a Reference to an attachment

If the previous comments contain a reference to an attachment, then it could result in those attachments being sent multiple times, as JEMHC will attach all attachments that have been referenced within the email body. This will then result in your data usage being used more quickly as it will increase the email size.

Solution

The solution would be to remove the occurrence of “^” from the previous comment’s attachment reference, as this would mean that JEMHC will treat it as a reference and will not attach the referred attachment. Below is an example that does this:

#set ( $comments = $jemhUtils.filterRestrictedComments($context.issue.fields.comment.comments) ) #if ( $comments.size() > 0 ) $jemhUtils.setCommentRendered() #end #foreach ($aComment in $comments) <strong>$jemhUtils.getUserDescription($aComment.author)</strong> <em>$aComment.updated.asText():</em> #set ($updatedCommentBody = $aComment.body.textValue().replace("[^", "[")) ## Remove the occurrence of "^" <p>$jemhUtils.wikiToHtml($updatedCommentBody)</p> #end