Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Default value for "Comment Viewable By"

Synaptics Tony Chang November 18, 2021

If you want to set default value for "Comment Viewable By" globally, here is steps : 

[ Default Group ]

1. Decide the group, e.g. jira-developers

2. Replace following code in the file atlassian-jira/WEB-INF/classes/templates/plugin/comment/system-comment-field-edit.vm


#if (!$comment && $defaultLevelEnabled)
#set ($selectedCommentLevel = "default")
#foreach ($level in $groupLevels)
#if ($level == 'jira-developers')
#set ($selectedCommentLevel = "group:jira-developers")
#end
#end
#else
#set ($selectedCommentLevel = "")
#end

instead of 

#if (!$comment && $defaultLevelEnabled)
#set ($selectedCommentLevel = "default")
#else
#set ($selectedCommentLevel = "")
#end

3. Replace following code in the file atlassian-jira/WEB-INF/classes/templates/jira/global.vm

#if ($isRolePresent)
#foreach ($level in $roleLevels)
#if($level.id && $selected == "role:${level.id.toString()}")
#set($currentSelection = "$i18n.getText('viewissue.comment.visibleby') <span class=redText>$level.name</span>")
#set($locked = true)
#end
#end
#end
#if ($isGroupPresent)
#foreach ($level in $groupLevels)
#if($level && $selected == "group:${level}")
#set($currentSelection = "$i18n.getText('viewissue.comment.visibleby') <span class=redText>$level</span>")
#set($locked = true)
#end
#end
#end

instead of

#if ($isRolePresent)
#foreach ($level in $roleLevels)
#if($level.id && $selected == "role:${level.id.toString()}")
#set($currentSelection = "$i18n.getText('security.level.restricted.to', ${textutils.htmlEncode($level.name)})")
#set($locked = true)
#end
#end
#end
#if ($isGroupPresent)
#foreach ($level in $groupLevels)
#if($level && $selected == "group:${level}")
#set($currentSelection = "$i18n.getText('security.level.restricted.to', ${textutils.htmlEncode($level)})")
#set($locked = true)
#end
#end
#end

4. Restart your JIRA application

[ Default Role ]

1. find project role id in [JIRA Administration] -> [System] -> [Project roles], e.g. Developers is 10001

2. Replace following code in the file atlassian-jira/WEB-INF/classes/templates/plugin/comment/system-comment-field-edit.vm


#if (!$comment && $defaultLevelEnabled)
#set ($selectedCommentLevel = "default")
#foreach ($level in $roleLevels)
#if ($level.id == 10001)
#set ($selectedCommentLevel = "role:10001")
#end
#end
#else
#set ($selectedCommentLevel = "")
#end

instead of 

#if (!$comment && $defaultLevelEnabled)
#set ($selectedCommentLevel = "default")
#else
#set ($selectedCommentLevel = "")
#end

3. Replace following code in the file atlassian-jira/WEB-INF/classes/templates/jira/global.vm

#if ($isRolePresent)
#foreach ($level in $roleLevels)
#if($level.id && $selected == "role:${level.id.toString()}")
#set($currentSelection = "$i18n.getText('viewissue.comment.visibleby') <span class=redText>$level.name</span>")
#set($locked = true)
#end
#end
#end
#if ($isGroupPresent)
#foreach ($level in $groupLevels)
#if($level && $selected == "group:${level}")
#set($currentSelection = "$i18n.getText('viewissue.comment.visibleby') <span class=redText>$level</span>")
#set($locked = true)
#end
#end
#end

instead of

#if ($isRolePresent)
#foreach ($level in $roleLevels)
#if($level.id && $selected == "role:${level.id.toString()}")
#set($currentSelection = "$i18n.getText('security.level.restricted.to', ${textutils.htmlEncode($level.name)})")
#set($locked = true)
#end
#end
#end
#if ($isGroupPresent)
#foreach ($level in $groupLevels)
#if($level && $selected == "group:${level}")
#set($currentSelection = "$i18n.getText('security.level.restricted.to', ${textutils.htmlEncode($level)})")
#set($locked = true)
#end
#end
#end

4. Restart your JIRA application

 

Reference Robert Wolf's comment in https://jira.atlassian.com/browse/JRASERVER-9091 

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events