|
|
@ -435,12 +435,12 @@ class WorkPackage < ActiveRecord::Base |
|
|
|
notified = project.notified_users |
|
|
|
notified = project.notified_users |
|
|
|
# Author and assignee are always notified unless they have been |
|
|
|
# Author and assignee are always notified unless they have been |
|
|
|
# locked or don't want to be notified |
|
|
|
# locked or don't want to be notified |
|
|
|
notified << author if author && author.active? && author.notify_about?(self) |
|
|
|
notified << author if author && author.notify_about?(self) |
|
|
|
if assigned_to |
|
|
|
if assigned_to |
|
|
|
if assigned_to.is_a?(Group) |
|
|
|
if assigned_to.is_a?(Group) |
|
|
|
notified += assigned_to.users.select { |u| u.active? && u.notify_about?(self) } |
|
|
|
notified += assigned_to.users.select { |u| u.notify_about?(self) } |
|
|
|
else |
|
|
|
else |
|
|
|
notified << assigned_to if assigned_to.active? && assigned_to.notify_about?(self) |
|
|
|
notified << assigned_to if assigned_to.notify_about?(self) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
notified.uniq! |
|
|
|
notified.uniq! |
|
|
@ -448,6 +448,21 @@ class WorkPackage < ActiveRecord::Base |
|
|
|
notified.select { |user| visible?(user) } |
|
|
|
notified.select { |user| visible?(user) } |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def notify?(user) |
|
|
|
|
|
|
|
case user.mail_notification |
|
|
|
|
|
|
|
when 'selected', 'only_my_events' |
|
|
|
|
|
|
|
author == user || user.is_or_belongs_to?(assigned_to) |
|
|
|
|
|
|
|
when 'none' |
|
|
|
|
|
|
|
false |
|
|
|
|
|
|
|
when 'only_assigned' |
|
|
|
|
|
|
|
user.is_or_belongs_to?(assigned_to) |
|
|
|
|
|
|
|
when 'only_owner' |
|
|
|
|
|
|
|
author == user |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
false |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def done_ratio |
|
|
|
def done_ratio |
|
|
|
if WorkPackage.use_status_for_done_ratio? && status && status.default_done_ratio |
|
|
|
if WorkPackage.use_status_for_done_ratio? && status && status.default_done_ratio |
|
|
|
status.default_done_ratio |
|
|
|
status.default_done_ratio |
|
|
|