Feature #2450
closedRemove Watchers
Added by Maxim Krušina almost 16 years ago. Updated about 15 years ago.
0%
Description
Maybe I just don't see it, but us there a way to remove a watcher?
Related issues
Updated by Nanda P over 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
Updated by James Byrne over 15 years ago
This feature is really needed in the case of a departed employee.
Updated by yamit motek over 15 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
Updated by Paul Rivier over 15 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.
Updated by Chris Cage over 15 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.
Updated by Kirill Ponomarev over 15 years ago
I can add wrong watcher to issue and I need remove him. It's my mistake and i want to fix it.
Updated by Rain Chen over 15 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 ?
Updated by Eric Davis about 15 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?
Updated by Filip Morávek about 15 years ago
- Assignee set to Jean-Philippe Lang
How about this? It is in trunk please?
It´s very useful feature...
Thanks a lot
Updated by Jason Best about 15 years ago
+1 The use cases outlined by Chris Cage are exactly mine.
Updated by Jean-Philippe Lang about 15 years ago
Rain, I didn't test your patch but it seems to allow anyone to remove watchers.
Updated by Jean-Philippe Lang about 15 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).