aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/alert_group.rb
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2011-06-09 18:09:52 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2011-06-09 18:09:52 +0100
commit495c44445642cfae8f23fadde299ad5307f5be58 (patch)
tree0104c9eef164235aa5ab05b126c8f63e52fb8624 /lib/mauve/alert_group.rb
parent0c88fcc91db1b003cd5d5311f62700c7867b4099 (diff)
Big commit
--HG-- rename : views/please_authenticate.haml => views/login.haml
Diffstat (limited to 'lib/mauve/alert_group.rb')
-rw-r--r--lib/mauve/alert_group.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/mauve/alert_group.rb b/lib/mauve/alert_group.rb
index d8156fa..288b263 100644
--- a/lib/mauve/alert_group.rb
+++ b/lib/mauve/alert_group.rb
@@ -29,11 +29,14 @@ module Mauve
logger.warn "no groups found for #{alert.id}" if groups.empty?
#
- # Notify each group.
+ # Notify just the group that thinks this alert is the most urgent.
#
- groups.each do |grp|
- logger.info("notifying group #{groups[0]} of AlertID.#{alert.id}.")
- grp.notify(alert)
+ %w(urgent normal low).each do |lvl|
+ this_group = groups.find{|grp| grp.level.to_s == lvl}
+ next if this_group.nil?
+ logger.info("notifying group #{this_group} of AlertID.#{alert.id} (matching #{lvl})")
+ this_group.notify(alert)
+ break
end
end
end