Feature #2450

Remove Watchers

Added by Maxim Krušina almost 13 years ago. Updated almost 12 years ago.

Status:ClosedStart date:2009-01-07
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:


Target version:0.9.0


Maybe I just don't see it, but us there a way to remove a watcher?

Related issues

Duplicated by Redmine - Defect #3313: Missing "Delete" option at issue watchers Closed 2009-05-07

Associated revisions

Revision 2977
Added by Jean-Philippe Lang almost 12 years ago

Add a permission to remove issue watchers (#2450).


#1 Updated by Maxim Krušina almost 13 years ago

  • Category set to Issues

#2 Updated by Michael Aye over 12 years ago


#3 Updated by Colan Schwartz over 12 years ago


#4 Updated by Alan Daveline over 12 years ago


#5 Updated by Nanda P over 12 years ago


By accident, if someone added as watcher, there shuld be a way to remove them. ofcourse with admin rights.

Right now, we have to ask the person to click on "Unwatch" to remove from watchers list

#6 Updated by Chaoqun Zou over 12 years ago


#7 Updated by James Byrne over 12 years ago

This feature is really needed in the case of a departed employee.

#8 Updated by Mark Pettigrew over 12 years ago


#9 Updated by yamit motek over 12 years ago

Dear Redmine,
im a nice person. i waited for 6 whole months for this removal of watchers if i want to (settings \ administration).
PLEASE do it PLEASE, im dying here!


#10 Updated by Paul Rivier over 12 years ago

Maybe you could help us giving a use case. To me it seems that a departed employee should have its account locked and should therefore not receive automatic mail.

#11 Updated by Chris Cage over 12 years ago

Here's the two use cases I have.

Accidental Attachment

I have a support user that I need to be able to login and check issues very occasionally. This user is never assigned issues and I have yet to come across a time when they need to watch an issue. However, because they are listed among the potential watchers when a new issue is created, I have had clients select the support user as a watcher. Because of the nature of the support users email, whenever they get an email from Redmine, there is an auto response that gets sent back to Redmine. This is just junk that then has to get cleaned up.

As an administrator, I would like to remove this watcher and not have to get the support team to remove themselves.

User Changes Responsibilities

A second situation involves a client who has changed roles within his organization. He is watching many issues and yes he could unwatch himself, but I would like the ability to do this for him as a courtesy. He still needs to be able to login to the system, but his new role is such that he is not involved on a day-to-day basis.

I realize neither of these situations is critical, but it would be nice as an administrator to have the ability to clean up watchers that don't need to be attached anymore.

#12 Updated by Kirill Ponomarev over 12 years ago

I can add wrong watcher to issue and I need remove him. It's my mistake and i want to fix it.

#13 Updated by Rain Chen about 12 years ago

hi all, I need this feature, so I do it my self, it about spent me 42 minutes to resolve(yes,I added this as an issue in my "Better Redmine" project), here are my solution, hopes helpful:

redmine/trunk$ svn st
?      nbproject
M      app/helpers/watchers_helper.rb
M      app/controllers/watchers_controller.rb

redmine/trunk$ svn diff
Index: app/helpers/watchers_helper.rb
--- app/helpers/watchers_helper.rb    (revision 2845)
+++ app/helpers/watchers_helper.rb    (working copy)
@@ -26,7 +26,9 @@
     url = {:controller => 'watchers',
            :action => (watched ? 'unwatch' : 'watch'),
            :object_type => object.class.to_s.underscore,
-           :object_id => object.id}           
+           :object_id => object.id,
+           :user_id => (user.id unless user == User.current)
+           }
     link_to_remote((watched ? l(:button_unwatch) : l(:button_watch)),
                    {:url => url},
                    :href => url_for(url),
@@ -36,6 +38,11 @@

   # Returns a comma separated list of users watching the given object
   def watchers_list(object)
-    object.watcher_users.collect {|u| content_tag('span', link_to_user(u), :class => 'user') }.join(",\n")
+    watcher_users = object.watcher_users.collect {|u|
+      user = content_tag('span', link_to_user(u), :class => 'user')
+      watcher =  watcher_tag(object, u)
+      content_tag('div', "#{user} #{watcher}", :class => "watcher")
+    }
+    content_tag('div', watcher_users, :id => 'watcher_users')
Index: app/controllers/watchers_controller.rb
--- app/controllers/watchers_controller.rb    (revision 2845)
+++ app/controllers/watchers_controller.rb    (working copy)
@@ -29,7 +29,12 @@

   def unwatch
-    set_watcher(User.current, false)
+    unless params[:user_id].blank?
+      @user = User.find(params[:user_id])
+    else
+      @user = User.current
+    end
+    set_watcher(@user, false)

   def new
@@ -62,7 +67,10 @@
     @watched.set_watcher(user, watching)
     respond_to do |format|
       format.html { redirect_to :back }
-      format.js { render(:update) {|page| page.replace_html 'watcher', watcher_link(@watched, user)} }
+      format.js { render(:update) {|page| 
+          page.replace_html 'watcher', watcher_link(@watched, user) if user == User.current
+          page.replace_html 'watcher_users', watchers_list(@watched)
+        } }
   rescue ::ActionController::RedirectBackError
     render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true

And I think this is not so hard to merge to the trunk right ?

#14 Updated by Eric Davis about 12 years ago

Thanks for the patch Rain Chen. For it to get into trunk, we will need unit and functional tests to confirm that the behavior is correct. Would you be able to write some?

#15 Updated by Maxim Krušina about 12 years ago

WOW, it's almost here 8)))

#16 Updated by John Pataki about 12 years ago


#17 Updated by Filip Morávek about 12 years ago

  • Assignee set to Jean-Philippe Lang

How about this? It is in trunk please?

It´s very useful feature...

Thanks a lot

#18 Updated by Jason Best about 12 years ago

+1 The use cases outlined by Chris Cage are exactly mine.

#19 Updated by Jean-Philippe Lang almost 12 years ago

Rain, I didn't test your patch but it seems to allow anyone to remove watchers.

#20 Updated by Jean-Philippe Lang almost 12 years ago

  • Status changed from New to Closed
  • Target version set to 0.9.0
  • Resolution set to Fixed

Feature added in r2977 (requires the new 'Delete watchers' permission).

Also available in: Atom PDF