aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/configuration_builders/people_list.rb
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2012-05-03 19:42:20 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2012-05-03 19:42:20 +0100
commit58f5a950200f5957307a8552b92ce9e92f948b73 (patch)
treee7e5dbf2178dfd46e88e8e6d60d6665c58b538fa /lib/mauve/configuration_builders/people_list.rb
parent3a008fd3fff00852533d0df1f597595505373c6b (diff)
* Person and people lists have now become interchangeable, with notifications
only recording the username, rather than the Person/PeopleList. This means that notifications in alert groups can use default #during clauses and #every values from people lists and persons. * Notify clauses can now take an array of persons/people_lists, and people_lists can refer to other people lists. * PeopleList names are now in the same namespace as usernames. * Tests to go with.
Diffstat (limited to 'lib/mauve/configuration_builders/people_list.rb')
-rw-r--r--lib/mauve/configuration_builders/people_list.rb15
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/mauve/configuration_builders/people_list.rb b/lib/mauve/configuration_builders/people_list.rb
index fffa15c..7a5f3ab 100644
--- a/lib/mauve/configuration_builders/people_list.rb
+++ b/lib/mauve/configuration_builders/people_list.rb
@@ -9,9 +9,9 @@ module Mauve
class PeopleList < ObjectBuilder
- is_builder "notification", Notification
+ is_builder "notification", ConfigurationBuilders::Notification
- def builder_setup(label, list)
+ def builder_setup(label, *list)
@result = Mauve::PeopleList.new(label)
@result += list
@result
@@ -41,14 +41,9 @@ module Mauve
# @param [Mauve::PeopleList] people_list
#
def created_people_list(people_list)
- label = people_list.label
- if @result.people_lists.has_key?(label)
- _logger.warn("Duplicate people_list '#{label}'")
- @result.people_lists[label] += people_list.list
- else
- @result.people_lists[label] = people_list
- end
+ name = people_list.username
+ raise ArgumentError.new("Duplicate person '#{name}'") if @result.people[name]
+ @result.people[name] = people_list
end
-
end
end