Tuesday, June 26, 2012

Automatically Set Comment Visibility in JIRA

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:

  1. Remove all entries from the "Issue Commented" system event in the notification schemes.
  2. Create a new custom event, which I fire in my custom handler for IssueCommented (see below).
  3. Add notification scheme entries to this custom event instead, so people still get notified, but only after the comment visibility has been edited.
Here's the groovy listener I used to get the job done: