Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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 1 - break the markup syntax

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:

Code Block
#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

Solution 2 - full linked file markup removal

This is more complex, the regexp ‘must’ match all combos, those with international chars in filenames need more work:

Code Block
#set ( $comments = $jemhUtils.filterRestrictedComments($context.issue.fields.comment.comments) )
#if ( $comments.size() > 0 )
    $jemhUtils.setCommentRendered()
#end
<h3>Historic Comments</h3>
#foreach ($aComment in $comments)
    <strong>$jemhUtils.getUserDescription($aComment.author)</strong>
    #set ($strippedComment = $aComment.body.asText().replaceAll("\[\^[a-z0-9 -]+\.[a-z]+\]","(attachment excluded)"))
    <p>$jemhUtils.wikiToHtml($strippedComment)</p>
#end