Desactivate the autowatch for the current user

Hi, 
I had found a script for desactivate the autowatch for all the users. 

Could someone modify the script for desactivate the autowatch only for the reporter of an issue? 
My idea is to desactivate the autowatch in the creation transition. 
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.preferences.PreferenceKeys
 
def userManager = ComponentAccessor.getUserManager()
def preferencesManager = ComponentAccessor.getUserPreferencesManager()
userManager.getUsers().each {user ->
    preferencesManager.getPreferences(user).setBoolean(PreferenceKeys.USER_AUTOWATCH_DISABLED, true)   
}
Thanks!!!!

2 answers

Autowatch makes the user who makes an action, edit, transition, comment, etc. on the issue as a watcher on that issue. So he gets the updates from the issue that he has done some work. It is not limited to reporter or any other role. 

Autowatch can be on or off, you cannot customize it.

Autowatch is a profile setting for each user. So the script you have is going through all the users and setting the autowatch to false.

0 vote

As Vijay says, the script you found is for disabling the autowatch preference

I can't think of a trivial way to do what you want... you could remove the watch in a listener but as the autowatch service is also a listen you have no guarantees about order.

Why do you want to deactivate autowatching for the reporter?

There is a possibility to desactivate the autowatch for all the users on Jira, but I want to disable only for a project. I understand that it's against the concept of JIRA. 

On my projects, on my issues, all the users who are putting comments, automatically become watchers. And I don't want to send notifications for all the users who have commented. 

I want to customize by workflow the users who must be watcher. Then, notifications could be sent to the proper person.  

The problem is that every new user inherit the global preferences that allows autowatch. Each new user must desactivate that. But I want to do it automatically whitout asking each user.....

You could use an event listener that removes the watcher in a new thread with a delay of a second or so. 

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

357 views 0 6
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