diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-04-08 08:02:06 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-04-08 08:02:06 +0000 |
commit | 2f77bfde91846b799d70a436783a8eee2741bf75 (patch) | |
tree | 462714ea74eaf4d1de0f83784ee0c0549076b018 /app/models/member.rb | |
parent | e4fac91b7da8e4482da06fc33c3d9eeac2d66dc1 (diff) | |
download | redmine-2f77bfde91846b799d70a436783a8eee2741bf75.tar.gz redmine-2f77bfde91846b799d70a436783a8eee2741bf75.zip |
Option to set a default assignee on each project (#482).
Patch by Felix Schäfer.
git-svn-id: http://svn.redmine.org/redmine/trunk@16525 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/member.rb')
-rw-r--r-- | app/models/member.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/member.rb b/app/models/member.rb index 24376d303..0911422c4 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -27,7 +27,7 @@ class Member < ActiveRecord::Base validate :validate_role attr_protected :id - before_destroy :set_issue_category_nil + before_destroy :set_issue_category_nil, :remove_from_project_default_assigned_to scope :active, lambda { joins(:principal).where(:users => {:status => Principal::STATUS_ACTIVE})} @@ -151,6 +151,13 @@ class Member < ActiveRecord::Base end end + def remove_from_project_default_assigned_to + if user_id && project && project.default_assigned_to_id == user_id + # remove project based auto assignments for this member + project.update_column(:default_assigned_to_id, nil) + end + end + # Returns the roles that the member is allowed to manage # in the project the member belongs to def managed_roles |