I struggled with setting the visibility of comments automatically in JIRA. I first tried the Jira Behaviours plugin but ran into the problems described here: https://studio.plugins.atlassian.com/browse/JBHV-158
Next, I tried using the groovy script runner plugin to set the security when a comment was created. After much banging my head against the wall, I finally got this to work. Unfortunately it was still e-mailing people before I had a chance to set the proper visibility.
The fix for that was to:
- Remove all entries from the "Issue Commented" system event in the notification schemes.
- Create a new custom event, which I fire in my custom handler for IssueCommented (see below).
- Add notification scheme entries to this custom event instead, so people still get notified, but only after the comment visibility has been edited.