Don't notify users about relations that are not visible (#1005).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12015 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang committed 2013-07-13 10:32:48 +00:00
1 parent 7509dda1ff
commit 0087d237f7
3 files changed
+33 -3

No files matched your search

+13
View File
@@ -68,6 +68,19 @@ class Journal < ActiveRecord::Base
end
end
def each_notification(users, &block)
if users.any?
users_by_details_visibility = users.group_by do |user|
visible_details(user)
end
users_by_details_visibility.each do |visible_details, users|
if notes? || visible_details.any?
yield(users)
end
end
end
end
# Returns the new status if the journal contains a status change, otherwise nil
def new_status
c = details.detect {|detail| detail.prop_key == 'status_id'}