Add custom thumbnail/icon/text next to name in comment based on user group

grumbens September 25, 2019

I need to achieve that in issue comments, based on user group, for an example if comment user is in group developers show in comment header some text/icon near user display name. In this case text shows [DEV] - which indicates that user is developer. 

As i understand that place which renders the comment header is in file:

$JIRA-HOME/WEB-INF/classes/templates/plugins/jira/macros.vm

near at

$i18n.getText('issue.tabpanels.comment.action.header', $userformat.formatUserkey($authorKey, 'profileLinkActionHeader', "commentauthor_${comment.id}_$!{suffix}"), $createdDate) #if($visibilityLevel) - $visibilityLevel #end #if($updateInfo) - <span class="redText subText" title="$updateInfo">$i18n.getText('common.concepts.edited')</span> #end


I tried to add a simple user lookup in groups using $jiraUserUtils or $groupManager helper class methods and shows some text based on group:

#if($groupManager.getGroupNamesForUser($author).contains("developers"))
     <span>[DEV]</span>
#end

or

#if ($jiraUserUtils.getGroupNamesForUser($author).contains("developers"))
    <span>[DEV]</span>
#end


But it seems that in this template $jiraUserUtils$groupManager helper class not available in the context.

Any ideas how to get work it here?

The main idea is to show that comment owner/updater is internal developer not external requester. 

Something like that:

dev-next-to-name.PNG

ENV: JIRA: 7.x

0 answers

Suggest an answer

Log in or Sign up to answer