Feature #8568
openadd ability to designate default watchers by tracker/project
0%
Description
There is a situation we have where it would be nice to be able designate a default set of watchers for a given tracker/project. The scenario would happen like this:
- In the project, we would configure a tracker, for example "Bug", to have default users Aya and Bubba
- Later, someone creates a new issue with tracker Bug, fills out details but does not specify any watchers
- Upon the issue being created as tracker Bug in this specific project, Redmine automatically adds the watchers Aya and Bubba to this bug.
- Aya and Bubba get updates about the issue because they are watchers.
Related issues
Updated by Rahul Panwar about 13 years ago
Is there any plan for this feature, it is really a useful feature? We can define a list of default watchers per project.
Updated by Felix Sendino about 13 years ago
Isn't there any news about this subject?
It would be very useful to manage teamwork for ticket-helpdesk purposes.
We have several workflows managed by redmine, for example to manage restore querys by final users or to manage application deployments by developers,
These are managed by different teams-groups.
When we define this kind of project an associate an email acount to it, so users can send issues through redmine,
It would be really useful that all the members in the team/project would be auto-set as watchers of the issue to coordinate the work.
Another aproach would be to have a ROL which meant that the member of the project is set as a watcher of its issues
Updated by Zee Prime almost 13 years ago
Here's what we're using:
In Settings->Project, you can specify a role for the default watchers. You could use an existing role (e.g. "Manager") or create a new one (e.g. "Watcher"). Whenever a new issue is created, anyone who is in that role for that project is set as a default watcher for the issue. If the user creating the issue has permission to edit watchers, they can override this, but we've found that in most cases nobody even looks at the watchers list when they create a new issue and they just leave it as the default. Because this is hooked directly into the Issue constructor, it works regardless of whether you create an issue through the web interface, the API, incoming email, etc.
-Z'
PS: This is a patch against redmine 1.1.1.
Index: app/views/settings/_projects.rhtml
===================================================================
--- app/views/settings/_projects.rhtml (revision 505)
+++ app/views/settings/_projects.rhtml (revision 518)
@@ -9,8 +9,11 @@
<p><%= setting_check_box :sequential_project_identifiers %></p>
<p><%= setting_select :new_project_user_role_id,
Role.find_all_givable.collect {|r| [r.name, r.id.to_s]},
:blank => "--- #{l(:actionview_instancetag_blank_option)} ---" %></p>
+
+<p><%= setting_select :default_watchers_role_id,
+ ([["", "0"]] + Role.find_all_givable.collect {|r| [r.name, r.id.to_s]}) %></p>
</div>
<%= submit_tag l(:button_save) %>
Index: app/controllers/issues_controller.rb
===================================================================
--- app/controllers/issues_controller.rb (revision 505)
+++ app/controllers/issues_controller.rb (revision 518)
@@ -292,10 +292,15 @@
return false
end
@issue.start_date ||= Date.today
+ @issue.watcher_user_ids ||= []
+ @watcher_role = Role.find(Setting.default_watchers_role_id)
+ if !@watcher_role.nil?
+ @issue.watcher_user_ids |= @project.users_by_role[@watcher_role].collect{|u| u.id}
+ end
if params[:issue].is_a?(Hash)
@issue.safe_attributes = params[:issue]
if User.current.allowed_to?(:add_issue_watchers, @project) && @issue.new_record?
- @issue.watcher_user_ids = params[:issue]['watcher_user_ids']
+ @issue.watcher_user_ids |= params[:issue]['watcher_user_ids']
end
end
@issue.author = User.current
Index: config/settings.yml
===================================================================
--- config/settings.yml (revision 505)
+++ config/settings.yml (revision 518)
@@ -164,6 +164,10 @@
new_project_user_role_id:
format: int
default: ''
+# Role that denotes the default watchers
+default_watchers_role_id:
+ format: int
+ default: 0
sequential_project_identifiers:
default: 0
# encodings used to convert repository files content to UTF-8
Index: config/locales/en.yml
===================================================================
--- config/locales/en.yml (revision 505)
+++ config/locales/en.yml (revision 518)
@@ -351,6 +351,7 @@
setting_openid: Allow OpenID login and registration
setting_password_min_length: Minimum password length
setting_new_project_user_role_id: Role given to a non-admin user who creates a project
+ setting_default_watchers_role_id: Role containing all of the default watchers for a project
setting_default_projects_modules: Default enabled modules for new projects
setting_issue_done_ratio: Calculate the issue done ratio with
setting_issue_done_ratio_issue_field: Use the issue field
Updated by Razi Baluchi over 12 years ago
Emailed requests do not appear to pickup the default watchers.
Updated by j l over 12 years ago
Hi,
I tested this with 1.3 and it works great IF ALL the projects have someone assigned as a default watcher. It broke creating new issues for projects that didn't have a default watcher defined. The issue (at least I think) is that @watcher_role is not nil, but returns empty if it can't find any user ids associated with that role. (in app/controllers/issues_controller.rb). My experience with ruby is less than 10 minutes, so let me know if there's a better way. Maybe there's something else going on, but this seemed to fix it.
I changed
@issue.watcher_user_ids |= @project.users_by_role[@watcher_role].collect{|u| u.id}
to
if @project.users_by_role[@watcher_role]
@issue.watcher_user_ids |= @project.users_by_role[@watcher_role].collect{|u| u.id}
end
Thanks for this patch, works awesome otherwise!
Updated by j l over 12 years ago
Also, the default watcher works for me when an email creates an issue automatically
Updated by Sergio Talente about 11 years ago
In my company we are trying to do the same: opening an issue by email having a default watcher notified at the same time.
I tried to apply the patch you published but it is not possible because we are using a different version of Redmine.
Could you be so kind to post the patch for Redmine version 1.4.4?
Thanks in advance.
Updated by Antoine Gefflot over 10 years ago
In my company, people request to be able to define default watchers for issues
Many way to do that:- Add the capability for each user to be a default watcher
- Add the capability to define many roles as default watchers
- Add the capability to set all members as default watchers
The third one seems to be the simplest but I prefer the second one
Updated by Damon Tabb over 9 years ago
Has this been implemented? Our developer is running 2.3.1.stable. I handle software testing on our end of things, and it would be super useful if I could just be selected as a default watcher on ALL new issues (since testers/developers sometimes forget to select me as a watcher when creating new bugs), that way I could receive emails when bugs are added, updated, etc.... This seems like a very basic feature, no?
Updated by Mischa The Evil over 9 years ago
Damon Tabb wrote:
Has this been implemented?
No, it is not.
Updated by philip champon over 8 years ago
+1
also, here's a patch for 3.2
diff -rub '--exclude=log' '--exclude=tmp' /tmp/foo/app/models/issue.rb ./app/models/issue.rb
--- /tmp/foo/app/models/issue.rb 2015-12-06 14:06:19.000000000 +0000
+++ ./app/models/issue.rb 2016-02-02 18:40:25.468758582 +0000
@@ -175,6 +175,10 @@
# set default values for new records only
self.priority ||= IssuePriority.default
self.watcher_user_ids = []
+ # force project= method to run, generate default watchers
+ if attributes && proj = attributes[:project] || attributes["project"]
+ self.project = proj
+ end
end
end
@@ -364,6 +368,12 @@
self.fixed_version_id = project.default_version_id
end
end
+ if new_record?
+ watcher_role = Role.find(Setting.default_watchers_role_id)
+ if !watcher_role.nil? && project.users_by_role[watcher_role]
+ self.watcher_user_ids |= project.users_by_role[watcher_role].collect &:id
+ end
+ end
self.project
end
diff -rub '--exclude=log' '--exclude=tmp' /tmp/foo/app/views/settings/_projects.html.erb ./app/views/settings/_projects.html.erb
--- /tmp/foo/app/views/settings/_projects.html.erb 2015-12-06 14:06:19.000000000 +0000
+++ ./app/views/settings/_projects.html.erb 2016-02-02 17:34:57.310787484 +0000
@@ -14,6 +14,9 @@
<p><%= setting_select :new_project_user_role_id,
Role.find_all_givable.collect {|r| [r.name, r.id.to_s]},
:blank => "--- #{l(:actionview_instancetag_blank_option)} ---" %></p>
+
+<p><%= setting_select :default_watchers_role_id,
+ ([["", "0"]] + Role.find_all_givable.collect {|r| [r.name, r.id.to_s]}) %></p>
</div>
<%= submit_tag l(:button_save) %>
diff -rub '--exclude=log' '--exclude=tmp' /tmp/foo/config/locales/en.yml ./config/locales/en.yml
--- /tmp/foo/config/locales/en.yml 2015-12-06 14:06:23.000000000 +0000
+++ ./config/locales/en.yml 2016-02-02 17:46:07.441171951 +0000
@@ -352,6 +352,7 @@
field_total_estimated_hours: Total estimated time
field_default_version: Default version
+ setting_default_watchers_role_id: Role containing all of the default watchers for a project
setting_app_title: Application title
setting_app_subtitle: Application subtitle
setting_welcome_text: Welcome text
diff -rub '--exclude=log' '--exclude=tmp' /tmp/foo/config/settings.yml ./config/settings.yml
--- /tmp/foo/config/settings.yml 2015-12-06 14:06:23.000000000 +0000
+++ ./config/settings.yml 2016-02-02 17:57:32.200183079 +0000
@@ -257,3 +257,6 @@
default:
- '6'
- '7'
+default_watchers_role_id:
+ format: int
+ default: 13
Updated by Go MAEDA over 8 years ago
- Has duplicate Feature #13787: Observateurs par défaut? added
Updated by Dan MP about 8 years ago
Thank you for the patch Philippos Athanasiades Champon. Really helpful.
Unfortunately is broking the import issue functionality. I think has something to do with the Trackers, but as I'm a newbie in Redmine and 0 experience in Ruby I can't tell where the problem really is.
Also the logs are for me a mystery. If you can guide me what logs to look I can be of some help.
Again thank you for the work around it saved me some troubles.
Updated by Toshi MARUYAMA about 8 years ago
- Related to Feature #1602: Email options for Roles added
Updated by Fred B over 7 years ago
Zee Prime wrote:
Here's what we're using:
In Settings->Project, you can specify a role for the default watchers. You could use an existing role (e.g. "Manager") or create a new one (e.g. "Watcher").
I dont see that anywhere in my redmine 2.4.
What it a wish or a feature present at the time he wrote this?
Updated by Taine Woo about 5 years ago
I think i will prefer to add the default watchers for Category, or maybe both tracker and category, then Redmine will collect all the values of them.
Updated by Jie Lio about 4 years ago
Hi, There is another way to watcher all updates of project. You can change email notification options to receive all notifications which from projects i involved, in my account page.
Updated by R Pommier over 3 years ago
Would it be interesting to close (reject?) the issue and redirect the users/reporters to a Redmine plugin, or another way to do the job (as Jie Lio suggested)?