Default comment visibility in Jira 7.2X

Hi All,

This is related to the post Set default comment visibility.
The solution does not work for Jira 7.2.9.

It looks like there is some issue with the vm or config or lookup

when we change default to a project role there is a rendering issue.


image.png

The change is 

#if ($commentLevel)
    #set ($selectedCommentLevel = $commentLevel)
#else
    #if (!$comment && $defaultLevelEnabled)
        #set ($selectedCommentLevel = "role:10000")
    #else
        #set ($selectedCommentLevel = "")
    #end
#end

in the file system-comment-field-edit.vm

Any help is appreciated!

Thanks,
Parashar

3 answers

1 accepted

0 vote

Hi Parshar,

There is a Suggestion at JRASERVER-9091.  Please vote on that Suggestion and add any use cases so we can gain some traction into getting this added into JIRA.

Cheeers,

Branden

having the some issue. @Parashar Joshi have you gotten any update?

Best,

Ming

Hi Martin,

Please vote on JRASERVER-9091 as well so we can add impact to this to get the feature implemented in JIRA.

Cheers,

Branden

Yes, I did.

Cheers.

-M

Hi Martin,

 

We worked around the rendering issue by updating global.vm where we replaced the line 
#set($currentSelection = "$i18n.getText('security.level.restricted.to', $

{textutils.htmlEncode($level.name)}

)")

with

#set($currentSelection = "Restricted to <span class='redText'>Users</span>")

with this we do not see the rendering issue but this restricts the internationalization of the text displayed meaning any user irrespective of their language preference they see the text "Restricted to Users".

The change in  system-comment-field-edit.vm would still be needed and global.vm change is only to fix the Text displayed in the browser UI.

Hope this helps.

-Parashar

Hi Parashar,

Thanks so much for the reply.

I did in a similar way. You are right the issue is somehow related to $18n function here.

But instead of giving a fixed value, I set like this " Restricted to <span class='redText'>${textutils.htmlEncode($level.name)}</span>"

Regards,

-M

+1
Yeah, i did not think about that.

Hi,

This is working perfeclty for us in 7.4.3.
But I have still an issue...

If I add a comment with a different role and then want to add another comment, the default is not the one defined in the .vm file but the last one I used.

Is there a way to avoid this and always use the default role from the file?

Thank you very much,

Marius

Hi Marius,

I don't think that is possible as the value is chosen based on the user's last choice. 

The default is only used if there is no last used data for the user.

Hope this helps.

-Parashar

Hi Parashar,

thanks for the answer.

I did it now with a banner script.
I used this before, but with the update it did not work for comment within transitions... so when I change the config file system-comment-field-edit.vm and global.vm and use the script everything works perfetly:
Default in all commentfields (inclusive transitions) is "Internal" and the system ist not using the last used level anymore.

 

Banner Script if someone is interested:

<script language="JavaScript">

var defaultRoleName = "role:10020";
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; });
jQuery('#issue-comment-add-cancel').live('click', function(){ customRoleSelected = false; })
jQuery('#issue-comment-add-submit').live('click', function(){ customRoleSelected = false; })
</script>

 

Cheers,

Marius

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira Service Desk

How the Telegram Integration for Jira helps Sergey's team take their support efficiency to the bank

...+ reading Fantasy). The same is true for him at the bank he works for: Efficiency is key when time literally equals money. Read on to learn how Sergey makes most of the time he has by...

213 views 0 2
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