Default comment visibility in Jira 7.2X

Parashar Joshi
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 30, 2017

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 votes
Answer accepted
somethingblue
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 3, 2017

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

0 votes
Marius Tiedtke December 6, 2017

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

Parashar Joshi
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 6, 2017

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

Marius Tiedtke December 7, 2017

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

0 votes
Martin Tang September 27, 2017

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

Best,

Ming

somethingblue
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 27, 2017

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

Martin Tang September 27, 2017

Yes, I did.

Cheers.

-M

Parashar Joshi
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 28, 2017

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

Martin Tang September 28, 2017

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

Parashar Joshi
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 6, 2017

+1
Yeah, i did not think about that.

Suggest an answer

Log in or Sign up to answer