Vote #64385
完了Remove Watchers
0%
journals
--------------------------------------------------------------------------------
+1
--------------------------------------------------------------------------------
+1
--------------------------------------------------------------------------------
+1
--------------------------------------------------------------------------------
+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
--------------------------------------------------------------------------------
+1
--------------------------------------------------------------------------------
This feature is really needed in the case of a departed employee.
--------------------------------------------------------------------------------
+1
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
I can add wrong watcher to issue and I need remove him. It's my mistake and i want to fix it.
--------------------------------------------------------------------------------
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:
<pre>
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
</pre>
And I think this is not so hard to merge to the trunk right ?
--------------------------------------------------------------------------------
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?
--------------------------------------------------------------------------------
WOW, it's almost here 8)))
--------------------------------------------------------------------------------
+1
--------------------------------------------------------------------------------
How about this? It is in trunk please?
It´s very useful feature...
Thanks a lot
--------------------------------------------------------------------------------
+1 The use cases outlined by Chris Cage are exactly mine.
--------------------------------------------------------------------------------
Rain, I didn't test your patch but it seems to allow anyone to remove watchers.
--------------------------------------------------------------------------------
Feature added in r2977 (requires the new 'Delete watchers' permission).
--------------------------------------------------------------------------------
related_issues
duplicates,Closed,3313,Missing "Delete" option at issue watchers