The comment visibility default selection can be configured?

The comment visibility can be selected when someone creates a new comment. However, the default selection is "All Users". Can it be changed to a specific group/project-role? Maybe on a project basis?

Thank you.

8 answers

1 accepted

13 votes
Accepted answer

You can change default comment visibility doing the next steps:

1.- Go to Administration->Issues->User Interface->Announcement Banner
2.- Put the next script:

<script language="JavaScript">
var defaultRoleName = "role:10001";
var customRoleSelected = false;

function changeCommentLevel()
if (customRoleSelected) return;

var commentLevelSelect = jQuery('.security-level select#commentLevel option[value=\'' + defaultRoleName + '\']');
if (commentLevelSelect)
{ var labelText = commentLevelSelect.first().text(); jQuery("select#commentLevel").val(defaultRoleName); jQuery("#commentLevel-multi-select a.drop span.icon").removeClass("icon-unlocked").addClass("icon-locked"); var htmlEscapedLabel = AJS.$("<div/>").text(labelText).html(); jQuery(".security-level span.current-level").html(AJS.format(AJS.params.securityLevelViewableRestrictedTo, htmlEscapedLabel)); }


jQuery('#comment').live('focus', changeCommentLevel);
jQuery('#commentLevel-suggestions').live('click', function()
{ customRoleSelected = true; }




CAUTION: 'role:10001' must be match with the role that you want to put default. In my case is 10001.

Hope this helps.

Best regards,


It works even when you have two different groups of users that need to have different defaults?

For example:

  • A group "customers" with default "All users".
  • jira-developers and jira-administrator and jira-users with default jira-users

BTW, thank you for your answer.

I think you're confusing terms.

One concept is a role of project. A Role contain user or group of user. For example in my JIRA configuration I have 2 role: Developers and Clients. 'Developers' contain the group of users of my configuration that are developers of my company and the same by role 'Clients'.

In my JIRA, I put default comment visibility to 'Developers' so ever comment I put in Issue can only view to developers. With this I prevent information leaks that I don't wnat to be seen by my clients.

Do you understand me?

Thanks Daniel!

This works for me!

Hi Daniel,

Could this be modified to hide a specific Project Role from showing in the Comment permissions drop down?

I'm trying to hide a specific Project Role from showing in the drop down for comments. Editing the global.vm seems to be the way to go, but I don't understand how to single out that Project Role from showing.

This is the code that controls the drop-down options:

#if ($isRolePresent)
<optgroup label="$i18n.getText('common.words.project.roles')">
#foreach ($level in $roleLevels)
<option value="role:${}" #if($ && $selected == "role:${}")selected="selected"#end>$textutils.htmlEncode($</option>

I'm hoping to modify this to hide on specific group, something like this:

#if ($isRolePresent && !ProjectRole == "Name of Project Role To be Hidden")
<optgroup label="$i18n.getText('common.words.project.roles')">
#foreach ($level in $roleLevels)
<option value="role:${}" #if($ && $selected == "role:${}")selected="selected"#end>$textutils.htmlEncode($</option>

But of course that logic doesn't work. Any suggestions?

Works like a charm, thanks Daniel!

Hi all,

This is almost what I am looking for! I just want to throw out this additional use-case and see if there are any solutions for it:

What if I want to have 2 different Comment buttons? One for regular comments visible to "All Users" and one for internal comments viewable to a specific project group only?

I have taken the script above and tweaked it to my best knowledge but I get a weird behavior that JIRA remembers the last used security level. It has to do with refreshing page in some way. Please take a look at this post for details:

Does anyone have a clue why this is the case and in that case is there a way of working around this?

Looking forwards to your replies!

// Svante

Hi, can someone explain to me how I make this work? I've placed the code in the banner field: /secure/admin/EditAnnouncementBanner.jspa without effect.



JIRA 5.2

Hi Daniel, Does this works for JIRA 6.x?

This doesn't work for Jira 6.3.14

Hello Daniel, I don't understand completely. If I want to set the default visibility for comments different than "all users" I put your peace of coding in the announcement banner? But's that for the entire Jira?

I only want to change the default visibility for comments for 1 specific project. How do I do that?

This is not available yet but the request seems to have gathered many votes:

The answer provided by Daniel is great, but using "jQuery.noConflict();" in the beggining of the code can break the Classic Agile boards with an infinite spinning wheel. To fix this, you can use the code Daniel provided and just remove this line.

Thanks Pietro,

I was having a strange behaviour where auto-complete wasn't working anymore in the issue navigator JQL filters and removing jQuery.noConflict() fixed it


Ok, thank you Danielle. I upvoted that issue.

In the meantime, I've found what could be a temporary workaround: the behaviours plugin. However, I haven't managed to make it work yet (w/ JIRA 5.0).

I think it's better my solution that to implement behaviours plugin...

If you upgrade JIRA, you will need to check the compatibility of the plugin with JIRA. However with my solution will not be necessary.

I tried the Behaviours functionality for this matter (hiding comments by default in a specific project for all users but 1 group) and it doesn't seem possible to do, because the comments are "not hidable". 

Than I am still looking for a solution to hide all comments for all users and only visible for 1 specific group and this within only 1 project (not over my entire Jira instance). Who can help me?

Hi, I realise you have found your answer but for others looking for an answer where they don't have to edit files or want a project level default then I have a paid plugin in the marketplace called comment security default ( This allows you to set a default globally or per project. You can also assign behaviour in case the permission is no longer available (you can force the user to choose a new permission). The default can be set for adding a comment, adding an attachment, logging work, linking issues and editing issues.



Very nice! Thank you Paul, I'm glad there is a cleaner way to do it.

Thanks, Manuel

I agree. Thanks for mentioning this. I find it better as not all of my teams will want the same default. I also like the color visual to support it as well. I just tested it and I will be requesting a purchase of it.

In my tests if the inital code, the edit comment doe snot waork (the visible always change to Developers).

I made some changes and it worked

<script language="JavaScript">

jQuery.noConflict( );
var defaultRoleName = "role:10001";
var roleSelected = false;

function changeCommentLevel( )
	if ( roleSelected )

	if ( jQuery( '#comment' ).val() != "" )
		// edition;
		roleSelected = true;

	var commentLevelSelect = jQuery( '.security-level select#commentLevel option[value=\'' + defaultRoleName + '\']' );
	if ( commentLevelSelect )
		var labelText = commentLevelSelect.first( ).text( );
		jQuery( "select#commentLevel" ).val( defaultRoleName );
		jQuery( "#commentLevel-multi-select a.drop span.icon" ).removeClass( "icon-unlocked" ).addClass( "icon-locked" );
		var htmlEscapedLabel = AJS.$( "<div/>" ).text( labelText ).html( );
		jQuery( ".security-level span.current-level" ).html( AJS.format( AJS.params.securityLevelViewableRestrictedTo, htmlEscapedLabel ) );
		roleSelected = true;


jQuery( '#comment' ).live( 'focus', changeCommentLevel );

Daniel, I assume that this is only possible in Hosted version of Jira, and not OnDemand (as onDemand correctly encodes anything entered in the Banner field). Are you aware of a way to do this or anything close in the OnDemand version?

If such a way exists then I think Atlassian would treat it as a security problem.

I agree that this would be a security issue if this approach were to be allowed - just checking to see if there are any other workarounds that might be possible using existing capabilities (without injecting javascript into pages via the banner)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,100 views 4 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you