diff options
Diffstat (limited to 'app/models/journal.rb')
-rw-r--r-- | app/models/journal.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/journal.rb b/app/models/journal.rb index 70ecc54f5..47ae12380 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -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'} |