Versions Compared

Key

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

Status
subtletrue
titleSince version 1.9.8

...

As of JEMH 1.9.8, JEMH's comment entity properties can be accessed via Velocity templates. This exposes several comment properties:

Property

Description

Value

sentByNonJiraUser

Was this comment sent by a Non-JIRA user?

Boolean value (true or false)

messageId

The message ID of the email that resulted in this comment

Message ID, for example: <f97nfg4b4545f+f455hkjh632gnd@mail.example.com>

profileId

The JEMH profile ID number that processed the comment

Number, for example: 1

reporterIsDefaultReporter

Is the comment created by the Default Reporter?

Boolean value (true or false)

from

The email address of the comment sender

Email address, for example: sender@example.com

to

The email address of the comment "to" recipient

CSV Email addresses, for example: u1@x.com,u2@y.com

cc

The email address list of the comment "cc" recipients

CSV Email addresses, for example: u3@x.com,u4@y.com

com.ppl.jsd.public.comment

Is the comment a JSD public comment

true if so, otherwise not defeined.

The above property values are retrieved by calling $jemhUtils.getCommentProperties(<comment object here>).getProperty("<property>").  For example:

...

Here is a small text format that uses the sentByNonJiraUser and from comment entity properties.  This takes the last comment made by a Non-JIRA user and then displays the senders email address, and the comment itself:

...

In this example, the resulting template output is this:

No Formatcode
This is the last public comment. It was made by admin (on behalf of andy@localhost):
    This is a comment made by a non-JIRA user. Hello!

Note

...

Want the last comment regardless of who sent it?

Alternatively, the following will show the last comment, only if it is a non-JIRA user who sent it:

Code Block
#set ($commentToShow = "")
#set ($lastComment = $allComments.getLastComment($issue))
#set ($commentSender = $jemhUtils.getCommentProperties($lastComment).getProperty("from"))
#set ($isNonJira = $jemhUtils.getCommentProperties($lastComment).getProperty("sentByNonJiraUser"))
#if ($commentSender && $isNonJira)
 This is the last Non-JIRA user comment. It was made by $commentSender:
 $lastComment.getBody()
#else
There are no comments to show
#end

Inhibit Notifications if comment was added using an incoming email from JEMH

If you would like to inhibit notifications for all comments that JEMH adds, then you would need to have can by having a condition that search searches for any JEMH Comment Properties that have been added and if found then it would mean that JEMH added the comment and should be inhibited.

Below is an example script that can be used within Issue Event templates

Code Block

...

#if($jemhUtils.getCommentProperties($comment)) ##Searches for JEMH Comment Properties for this Comment.
    $jemhUtils.setInhibitSending(true) ##Inhibits the notification
    $jemhUtils.setInhibitSendingReason("Comment was added through Email") ##Sets a Reason why it was inhbited, Shown in the JEMH logs
#else
    <p>No Comment properties so was not commented through email</p>
#end

Related Articles

Filter by label (Content by label)
showLabelsfalse
max5
showSpacefalse
cqllabel in ( "macro" , "velocity" , "template" , "comment" , "notification" , "entityproperties" )