...
Some changes were made to the isPrivateJSDComment method:
<= 2.7.18 and >= 2.7.24 | boolean isPrivateJSDComment(Comment c) |
---|---|
2.7.23+ (support TemplateUser) | boolean isPrivateJSDComment(ApplicationUser u, Comment c) boolean isPrivateJSDComment(TemplateUser tu, Comment c) |
Set Up a Velocimacro
Velocimacro's allow a section of a template to be repeatedly used in multiple templates, meaning that the VTL script only has to be written to and maintained in one place. We will define the macro and then use it in an Ad-Hoc notification template. You can of course just insert the code directly into the template if you wish.
Go to JEMH>Template Sets > Macros
On the User Macros tab, click Edit (the pencil icon).
Enter the following into the VTL editor window. The script in its current state will show the last comment on an issue that does not have a Project Role/Group level of visibility (i.e. a "public" comment). The final section of this wiki page will discuss alterations that can be made to make the comment specific to a role or group visibility level Note that $lastPublicComment.getBody() used here will output the unrendered wiki markup of the comment, see later for HTMLand TEXT rendering.
The Velocity script to enter:
Code Block language text #macro (showLastComment) #set ($commentList = $allComments.getComments($issue)) #set ($lastPublicComment = "") #if ($commentList.size()>0) #foreach ($comment in $commentList) #if (!$comment.getRoleLevel() && !$comment.getGroupLevel()) #set ($lastPublicComment = $comment) #end #end This is the last public comment, made by $lastPublicComment.getAuthorApplicationUser():<br> $lastPublicComment.getBody()<br> #else There are no public comments #end #end
Press Submit to save your changes
...
Go to JEMH>Template Sets
Add or Edit a custom notification template of your choice. In this example we are looking at an Ad-Hoc Notification
Our template makes use of some HTML formatting, so we will be placing our macro call in the HTML content section (if you are adding to an existing template, make sure you add in the correct place):
Test your template by entering an issue key in the field Preview Context IssueKey
The status "No Preview Context" will change to a blue icon. Press it to preview your template:
...