Ability to assign issues to groups (#2964).
Option is disabled by default. It can be turned on in application settings. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6306 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
+14
-6
@@ -22,7 +22,7 @@ class Issue < ActiveRecord::Base
|
||||
belongs_to :tracker
|
||||
belongs_to :status, :class_name => 'IssueStatus', :foreign_key => 'status_id'
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
belongs_to :assigned_to, :class_name => 'User', :foreign_key => 'assigned_to_id'
|
||||
belongs_to :assigned_to, :class_name => 'Principal', :foreign_key => 'assigned_to_id'
|
||||
belongs_to :fixed_version, :class_name => 'Version', :foreign_key => 'fixed_version_id'
|
||||
belongs_to :priority, :class_name => 'IssuePriority', :foreign_key => 'priority_id'
|
||||
belongs_to :category, :class_name => 'IssueCategory', :foreign_key => 'category_id'
|
||||
@@ -93,9 +93,11 @@ class Issue < ActiveRecord::Base
|
||||
when 'all'
|
||||
nil
|
||||
when 'default'
|
||||
"(#{table_name}.is_private = #{connection.quoted_false} OR #{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id = #{user.id})"
|
||||
user_ids = [user.id] + user.groups.map(&:id)
|
||||
"(#{table_name}.is_private = #{connection.quoted_false} OR #{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids}))"
|
||||
when 'own'
|
||||
"(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id = #{user.id})"
|
||||
user_ids = [user.id] + user.groups.map(&:id)
|
||||
"(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids}))"
|
||||
else
|
||||
'1=0'
|
||||
end
|
||||
@@ -109,9 +111,9 @@ class Issue < ActiveRecord::Base
|
||||
when 'all'
|
||||
true
|
||||
when 'default'
|
||||
!self.is_private? || self.author == user || self.assigned_to == user
|
||||
!self.is_private? || self.author == user || user.is_or_belongs_to?(assigned_to)
|
||||
when 'own'
|
||||
self.author == user || self.assigned_to == user
|
||||
self.author == user || user.is_or_belongs_to?(assigned_to)
|
||||
else
|
||||
false
|
||||
end
|
||||
@@ -482,7 +484,13 @@ class Issue < ActiveRecord::Base
|
||||
# Author and assignee are always notified unless they have been
|
||||
# locked or don't want to be notified
|
||||
notified << author if author && author.active? && author.notify_about?(self)
|
||||
notified << assigned_to if assigned_to && assigned_to.active? && assigned_to.notify_about?(self)
|
||||
if assigned_to
|
||||
if assigned_to.is_a?(Group)
|
||||
notified += assigned_to.users.select {|u| u.active? && u.notify_about?(self)}
|
||||
else
|
||||
notified << assigned_to if assigned_to.active? && assigned_to.notify_about?(self)
|
||||
end
|
||||
end
|
||||
notified.uniq!
|
||||
# Remove users that can not view the issue
|
||||
notified.reject! {|user| !visible?(user)}
|
||||
|
||||
Reference in New Issue
Block a user