Versions Compared

Key

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

...

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.

  1. Go to JEMH>Template Sets > Macros
    Image Removed

    Image Added

  2. On the User Macros tab, click Edit (the pencil icon).

    Image Removed
  3. Image Added

    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 (info) Note that $lastPublicComment.getBody() used here will output the unrendered wiki markup of the comment, see later for HTMLand TEXT rendering.

  4. The Velocity script to enter:

    Code Block
    languagetext
    #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
  5. Press Submit to save your changes

...

  1. Go to JEMH>Template Sets

  2. Add  or Edit  a custom notification template of your choice.  In this example we are looking at an Ad-Hoc Notification
    Image Removed

    Image Added
  3. 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):

  4. Test your template by entering an issue key in the field Preview Context IssueKey

  5. The status "No Preview Context" will change to a blue icon.  Press it to preview your template:

...