Gathering Links to all attachments

Summary

Currently JEMHC will stop old attachments from being re-added to new notifications. This is to help limit the amount of data that is used when sending notifications, as including all attachments would use your data usage up quite quickly. A workaround for this would be to add a link for each attachment as this will allow the recipient to download each attachment.

Warning

Due to the below, I would recommend testing this within a test instance to ensure there are no issues occurring, e.g. data being shared when it shouldn’t be.

  1. If there is attachments added through internal comments, then a link to these attachment will also be included. Meaning that a link will be provided to Customers and Email Only Users. Currently there is no way to filter these attachments.

  2. In order to download the attachments you would need to be already be signed into Jira Cloud for the attachments to be downloaded.

  3. The download links may not work Email Only Users or Customers as they may not have permission to view/download the attachments.

Template condition to render links to the attachments

To implement this you would need to modify the relevant template to include the following condition. This condition will render a link to each attachment within the notification, allowing for the attachment to be downloaded.

#if($context.issue.fields.attachment) <h2>Attachments</h2> #foreach( $attach in $context.issue.fields.attachment) #set($url = $attach.content.asText()) <a href="$url">$attach.filename.asText()</a> </br> #end #end

Once this is implemented you would then see that there is an Attachments section that contains a link for each attachment found on the issue. For example below:

image-20240122-160236.png

Template condition to render the images and to render links to other attachments

This may result in more data being used for each notification

To implement this you would need to modify the relevant template to include the following condition. This condition will render images inline and will include a link to each other attachment types within the notification, allowing for the attachment to be downloaded.

#if($context.issue.fields.attachment) <h2>Attachments</h2> #foreach( $attach in$context.issue.fields.attachment) #set($url = $attach.content.asText()) #if ("$attach.mimeType.asText()"=="image/png" || "$attach.mimeType.asText()" == "image/jpeg" ) ##Checks the attachment type <h2>$attach.filename.asText()</h2> <a href="$url"><img src="$url" width="25%"></a> #else Attachment not shown inline, see the attachment link: <a href="$url">$attach.filename.asText()</a> #end #end #end

Once this is implemented you would then see that there is an Attachments section that contains a link for each attachment and that the images have been rendered inline. For example below:

Screenshot from 2024-01-22 16-13-09.png