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

This widget could not be displayed.

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

This widget could not be displayed.

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.

This widget could not be displayed.

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
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

122 views 1 3
Join discussion

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