Autowatch on Time Logged

I was never a fan of the autowatch on comments. It's a good idea, but creates a bit too much noise for our users. But what I would like is something very similar in that anyone who logs time to an issue is auto-added as a watcher. Without writing custom code, does anyone know a solution?

3 answers

1 accepted

2 votes
Accepted answer

I crafted this today that adds anyone logging time to the watch list.

package com.custom

import com.atlassian.jira.event.issue.AbstractIssueEventListener
import com.atlassian.jira.event.issue.IssueEvent
import org.apache.log4j.Category
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.watchers.WatcherManager

class WorkLoggedListener extends AbstractIssueEventListener {
    Category log = Category.getInstance(WorkLoggedListener.class)
    void issueWorkLogged (IssueEvent event) {
    	log.debug ("----------- begin WorkLoggedListener --------------")
    	ComponentManager componentManager = ComponentManager.getInstance()
    	WatcherManager watcherManager = componentManager.getWatcherManager()
    	JiraAuthenticationContext jiraAuthenticationContext = componentManager.getJiraAuthenticationContext()
    	watcherManager.startWatching(jiraAuthenticationContext.getLoggedInUser(), event.issue)
    	log.debug ("----------- end WorkLoggedListener ----------------")

Upvoted, but I think you are over-complicating this. You can get a WatcherService via:


Then you don't need to create one yourself along with all its dependencies. Furthermore I think I would just use

watcherManager.startWatching(watcher, issue)

watcherManager.startWatching was a *much* cleaner way of doing this so I edited the code above to reflect my changes. Thanks for the tip, Jamie.

(i didn't use ComponentAccessor as you suggested above though. Instead, I stuck with ComponentManager.)

No worries. CA and CM do the same thing under the covers, but CA is @PublicApi, CM is not. One day... probably a very long time in the future, CM might be removed...

1 vote
Ivan Tse Atlassian Team Mar 14, 2013

That is odd. I would have assumed that the auto watch would have captured that action and added the user who logged time against the ticket to have been added as a watcher. I've made an improvement request for now to review consistency for what actions automatically add a watcher.

If logging time againast a ticket is one of the actions which adds a user as a watcher then your want to add users once they logged work will fall under the default auto-watch feature.

thanks, ivan. i voted up the issue, and i'm going to add a few of my thoughts.

0 votes

Without custom code, it is not possible.

how many times do i have to tell you to stop giving me bad news, jobin? ;)


Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

804 views 3 9
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