aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/configuration_builders/alert_group.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mauve/configuration_builders/alert_group.rb')
-rw-r--r--lib/mauve/configuration_builders/alert_group.rb29
1 files changed, 25 insertions, 4 deletions
diff --git a/lib/mauve/configuration_builders/alert_group.rb b/lib/mauve/configuration_builders/alert_group.rb
index 40e5d9d..851ab7f 100644
--- a/lib/mauve/configuration_builders/alert_group.rb
+++ b/lib/mauve/configuration_builders/alert_group.rb
@@ -19,7 +19,10 @@ module Mauve
#
# @return [Mauve::Notification] New notification instance.
def builder_setup(who)
- who = if @context.people[who]
+ who = if who.is_a?(Mauve::Person) or who.is_a?(Mauve::PeopleList)
+ who
+
+ elsif @context.people[who]
@context.people[who]
elsif @context.people_lists[who]
@@ -29,7 +32,8 @@ module Mauve
raise ArgumentError.new("You have not declared who #{who} is")
end
- @result = Mauve::Notification.new(who, @context.last_alert_group.level)
+
+ @result = Mauve::Notification.new(who)
end
is_attribute "every"
@@ -47,7 +51,6 @@ module Mauve
# @return [Mauve::AlertGroup] New alert group instance
def builder_setup(name="anonymous_name")
@result = Mauve::AlertGroup.new(name)
- @context.last_alert_group = @result
end
is_block_attribute "includes"
@@ -62,7 +65,25 @@ module Mauve
#
def created_notify(notification)
@result.notifications ||= []
- @result.notifications << notification
+
+ if notification.during.nil? and notification.every.nil?
+ @result.notifications += notification.person.notifications.collect do |n|
+ #
+ # Set up a new notification for each one defined for this person.
+ #
+ new_notification = Mauve::Notification.new(notification.person)
+ new_notification.level = @result.level
+ new_notification.every = n.every
+ new_notification.during = n.during
+ new_notification
+ end
+ else
+ #
+ # Set the level for this notification
+ #
+ notification.level = @result.level
+ @result.notifications << notification
+ end
end
end