From 1f4478a69ebcfd839ede63824d7612e63e000ece Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Sun, 19 Jun 2011 21:51:53 +0100 Subject: Fixed reminders for group notifications --- lib/mauve/alert_changed.rb | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'lib/mauve/alert_changed.rb') diff --git a/lib/mauve/alert_changed.rb b/lib/mauve/alert_changed.rb index 165ddff..a17c32f 100644 --- a/lib/mauve/alert_changed.rb +++ b/lib/mauve/alert_changed.rb @@ -106,16 +106,29 @@ module Mauve save else saved = false - unless alert_group.notifications.nil? alert_group.notifications.each do |notification| - notification.people.each do |person| - # Not interested in nil people. - next if person.nil? - - if person.username == self.person - person.remind(alert, level) + # + # Build an array of people that could/should be notified. + # + notification_people = [] + + notification.people.each do |np| + case np + when Person + notification_people << np.username + when PeopleList + notification_people += np.list + end + end + + # + # For each person, send a notification + # + notification_people.sort.uniq.each do |np| + if np == self.person + Configuration.current.people[np].remind(alert, level) self.remind_at = notification.remind_at_next(alert) save saved = true -- cgit v1.2.1