Detect that a Service Desk comment is private/internal

JEMH Cloud's templates filter out comments from notification depending on the recipients. The rules are:

  • If recipient is an email user, restricted (group and role visibility) and JSD private comments are excluded

  • If recipient is a JIRA user, JSD private comments are included

  • If recipient is a JIRA user, restricted comments are excluded according to the comments role or group visibility.

You can change this behavior by creating custom templates. Please checkout this how to page if you don't know how to customize templates.

Velocity code of system templates is as following:

Comments just added to the issue

JEMHC by default only renders comments just added via $context.comments not all comments on the issue.

## Iterating over the latest comments the recipient can see... #foreach( $comment in $jemhUtils.filterRestrictedComments($context.comments) ) ## rendering the comment $jemhUtils.wikiToHtml($comment.body.textValue())  ## tagging processing telling the notification system that a comment has been rendered ... $jemhUtils.setCommentRendered() #end

All Comments currently on the issue

By default, JEMH Cloud only notifies the latest 'just added' comments. 

To render all the comments, replace $context.comments with $context.issue.fields.comment.comments

## Iterating over all the comments the recipient can see... #foreach( $comment in $jemhUtils.filterRestrictedComments($context.issue.fields.comment.comments)) ## rendering the comment ... $jemhUtils.wikiToHtml($comment.body.textValue())  ## tagging processing telling the notification system that a comment has been rendered ... $jemhUtils.setCommentRendered() #end

Manually detecting JSM comment privacy

And if you want to detect if a comment is JSD private, you can use $jemhUtils.isPrivateJSDComment($comment) method.

## Iterating over all the comments the recipient can see... #foreach( $comment in $jemhUtils.filterRestrictedComments($context.issue.fields.comment.comments)) #if ($jemhUtils.isPrivateJSDComment($comment)) ## Private JSD Comment... #else ## Public JSD Comment... #end $jemhUtils.setCommentRendered() #end

And finally, if you want to do your own security (not recommended)

 

Related articles