diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-08-17 11:08:07 +0100 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-08-17 11:08:07 +0100 |
commit | 8c8e5ae926e0009743fe92dccb588783640a6022 (patch) | |
tree | e23eea583beac0caf5fb3e45a33b4d2ac7796abf /lib/mauve/alert_group.rb | |
parent | 79dcf16ec6d229d6c31e055ed8e6a98327526a3a (diff) |
* Reminder notifications now take the same path to notify as initial alerts
* Threading tidied -- processor will not do anything unless the timer has frozen
* Person#send_alert now tidied and merged with alert_changed
* POP3 server only shows alerts relevant to the user
* Server now defaults to using an in-memory SQLite database (good for testing)
* Server initializes a blank mauve config.
* Tests tidied up
Diffstat (limited to 'lib/mauve/alert_group.rb')
-rw-r--r-- | lib/mauve/alert_group.rb | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/lib/mauve/alert_group.rb b/lib/mauve/alert_group.rb index 6cff33b..114c39b 100644 --- a/lib/mauve/alert_group.rb +++ b/lib/mauve/alert_group.rb @@ -26,38 +26,13 @@ module Mauve grps end - # If there is any significant change to a set of alerts, the Alert - # class sends the list here so that appropriate action can be taken - # for each one. We scan the list of alert groups to find out which - # alerts match which groups, then send a notification to each group - # object in turn. - # - def notify(alerts) - alerts.each do |alert| - groups = matches(alert) - - # - # Make sure we've got a matching group - # - if groups.empty? - logger.warn "no groups found for #{alert}!" - next - end - - # - # Notify just the first group - # - this_group = groups.first - logger.info("notifying group #{this_group} of #{alert}") - this_group.notify(alert) - end - end - def logger Log4r::Logger.new self.to_s end def all + return [] if Configuration.current.nil? + Configuration.current.alert_groups end @@ -83,7 +58,7 @@ module Mauve self.includes = Proc.new { true } end - def to_s + def inspect "#<AlertGroup:#{name} (level #{level})>" end @@ -129,7 +104,7 @@ module Mauve # The notifications are specified in the config file. # notifications.each do |notification| - notification.alert_changed(alert) + notification.notify(alert) end end |