aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2011-06-19 21:51:53 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2011-06-19 21:51:53 +0100
commit1f4478a69ebcfd839ede63824d7612e63e000ece (patch)
tree09c008cd007e278624b8e76225eea127e7d14416
parentde83746b5a33f1d2ac573f67c94760cb0a67b57e (diff)
Fixed reminders for group notifications
-rw-r--r--lib/mauve/alert_changed.rb27
1 files changed, 20 insertions, 7 deletions
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