Project

General

Profile

Actions

Feature #2450

closed

Remove Watchers

Added by Maxim Krušina about 15 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
Normal
Category:
Issues
Target version:
Start date:
2009-01-07
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed

Description

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


Related issues

Has duplicate Redmine - Defect #3313: Missing "Delete" option at issue watchersClosedJean-Philippe Lang2009-05-07

Actions
Actions #1

Updated by Maxim Krušina about 15 years ago

  • Category set to Issues
Actions #2

Updated by Michael Aye about 15 years ago

+1

Actions #3

Updated by Colan Schwartz about 15 years ago

+1

Actions #4

Updated by Alan Daveline almost 15 years ago

+1

Actions #5

Updated by Nanda P almost 15 years ago

+1

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

Actions #6

Updated by Chaoqun Zou almost 15 years ago

+1

Actions #7

Updated by James Byrne almost 15 years ago

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

Actions #8

Updated by Mark Pettigrew over 14 years ago

+1

Actions #9

Updated by yamit motek over 14 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!

thx
yamit

Actions #10

Updated by Paul Rivier over 14 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.

Actions #11

Updated by Chris Cage over 14 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.

Actions #12

Updated by Kirill Ponomarev over 14 years ago

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

Actions #13

Updated by Rain Chen over 14 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')
   end
 end
Index: app/controllers/watchers_controller.rb
===================================================================
--- app/controllers/watchers_controller.rb    (revision 2845)
+++ app/controllers/watchers_controller.rb    (working copy)
@@ -29,7 +29,12 @@
   end

   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)
   end

   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)
+        } }
     end
   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 ?

Actions #14

Updated by Eric Davis over 14 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?

Actions #15

Updated by Maxim Krušina over 14 years ago

WOW, it's almost here 8)))

Actions #16

Updated by John Pataki over 14 years ago

+1

Actions #17

Updated by Filip Morávek over 14 years ago

  • Assignee set to Jean-Philippe Lang

How about this? It is in trunk please?

It´s very useful feature...

Thanks a lot

Actions #18

Updated by Jason Best over 14 years ago

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

Actions #19

Updated by Jean-Philippe Lang over 14 years ago

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

Actions #20

Updated by Jean-Philippe Lang over 14 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).

Actions

Also available in: Atom PDF