diff options
author | dakkar <dakkar@thenautilus.net> | 2017-02-07 18:32:55 +0000 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2017-02-07 18:32:55 +0000 |
commit | ed980d6059ac994499f1a75b4a56796e00184ff7 (patch) | |
tree | 578e494c6f8768760eea4861a99494d8402f7858 | |
parent | Fix typo in POD heading (diff) | |
download | Sietima-ed980d6059ac994499f1a75b4a56796e00184ff7.tar.gz Sietima-ed980d6059ac994499f1a75b4a56796e00184ff7.tar.bz2 Sietima-ed980d6059ac994499f1a75b4a56796e00184ff7.zip |
rename 'admin' to 'owner'
-rwxr-xr-x | example/sietima | 4 | ||||
-rw-r--r-- | lib/Sietima/Role/Headers.pm | 3 | ||||
-rw-r--r-- | lib/Sietima/Role/SubscriberOnly/Moderate.pm | 14 | ||||
-rw-r--r-- | lib/Sietima/Role/WithOwner.pm (renamed from lib/Sietima/Role/WithAdmin.pm) | 20 | ||||
-rw-r--r-- | t/tests/sietima/multi-role/debounce-moderate.t | 4 | ||||
-rw-r--r-- | t/tests/sietima/role/headers.t | 6 | ||||
-rw-r--r-- | t/tests/sietima/role/subscriberonly/moderate.t | 8 |
7 files changed, 28 insertions, 31 deletions
diff --git a/example/sietima b/example/sietima index 261a943..3e9e294 100755 --- a/example/sietima +++ b/example/sietima @@ -8,14 +8,14 @@ Sietima::CmdLine->new({ NoMail ReplyTo Headers - WithAdmin + WithOwner Debounce SubjectTag SubscriberOnly::Moderate WithMailStore )], args => { - admin => 'dakkar@thenautilus.net', + owner => 'dakkar@thenautilus.net', mail_store => { class => 'Sietima::MailStore::FS', root => '/tmp/sietima-store', diff --git a/lib/Sietima/Role/Headers.pm b/lib/Sietima/Role/Headers.pm index 27f79fb..166b355 100644 --- a/lib/Sietima/Role/Headers.pm +++ b/lib/Sietima/Role/Headers.pm @@ -67,9 +67,6 @@ sub _add_headers_to($self,$message) { ); } - # little renaming - $addresses->{owner} = delete $addresses->{admin}; - # if nobody declared a "post" address, let's guess it's the same # as the address we send from $addresses->{post} //= $return_path; diff --git a/lib/Sietima/Role/SubscriberOnly/Moderate.pm b/lib/Sietima/Role/SubscriberOnly/Moderate.pm index 0c56040..c0e4a01 100644 --- a/lib/Sietima/Role/SubscriberOnly/Moderate.pm +++ b/lib/Sietima/Role/SubscriberOnly/Moderate.pm @@ -13,7 +13,7 @@ Sietima::Role::SubscriberOnly::Moderate - moderate messages from non-subscribers my $sietima = Sietima->with_traits('SubscribersOnly::Moderate')->new({ %args, - admin => 'listmaster@example.com', + owner => 'listmaster@example.com', mail_store => { class => 'Sietima::MailStore::FS', root => '/tmp', @@ -24,26 +24,26 @@ Sietima::Role::SubscriberOnly::Moderate - moderate messages from non-subscribers A L<< C<Sietima> >> list with this role applied will accept incoming emails coming from non-subscribers, and store it for moderation. Each -such email will be forwarded (as an attachment) to the list's admin. +such email will be forwarded (as an attachment) to the list's owner. -The admin will the be able to delete the message, or allow it. +The owner will the be able to delete the message, or allow it. This is a "sub-role" of L<< C<SubscribersOnly>|Sietima::Role::SubscriberOnly >>, L<< C<WithMailStore>|Sietima::Role::WithMailStore >>, and L<< -C<WithAdmin>|Sietima::Role::WithAdmin >>. +C<WithOwner>|Sietima::Role::WithOwner >>. =cut with 'Sietima::Role::SubscriberOnly', 'Sietima::Role::WithMailStore', - 'Sietima::Role::WithAdmin'; + 'Sietima::Role::WithOwner'; sub munge_mail_from_non_subscriber ($self,$mail) { my $id = $self->mail_store->store($mail,'moderation'); my $notice = Email::Stuffer ->from($self->return_path->address) - ->to($self->admin->address) + ->to($self->owner->address) ->subject("Message held for moderation - ".$mail->header_str('subject')) ->text_body("Use id $id to refer to it") ->attach( @@ -53,7 +53,7 @@ sub munge_mail_from_non_subscriber ($self,$mail) { ); $self->transport->send($notice->email,{ from => $self->return_path, - to => [ $self->admin ], + to => [ $self->owner ], }); return; } diff --git a/lib/Sietima/Role/WithAdmin.pm b/lib/Sietima/Role/WithOwner.pm index 2781bf8..dccb904 100644 --- a/lib/Sietima/Role/WithAdmin.pm +++ b/lib/Sietima/Role/WithOwner.pm @@ -1,4 +1,4 @@ -package Sietima::Role::WithAdmin; +package Sietima::Role::WithOwner; use Moo::Role; use Sietima::Policy; use Sietima::Types qw(Address AddressFromStr); @@ -6,34 +6,34 @@ use namespace::clean; =head1 NAME -Sietima::Role::WithAdmin - role for lists with an owner / admin +Sietima::Role::WithOwner - role for lists with an owner =head1 SYNOPSIS - my $sietima = Sietima->with_traits('WithAdmin')->new({ + my $sietima = Sietima->with_traits('WithOwner')->new({ %args, - admin => 'listmaster@example.com', + owner => 'listmaster@example.com', }); =head1 DESCRIPTION -This role adds an L<< /C<admin> >> attribute, and exposes it via the +This role adds an L<< /C<owner> >> attribute, and exposes it via the L<< C<list_addresses>|Sietima/list_addresses >> method. On its own, this role is not very useful, but other roles (like L<< C<SubscriberOnly::Moderate>|Sietima::Role::SubscriberOnly::Moderate ->>) can have uses for an admin / owner address. +>>) can have uses for an owner address. =head1 ATTRIBUTES -=head2 C<admin> +=head2 C<owner> Required instance of L<< C<Email::Address> >>, coercible from a -string. This is the address of the owner / admin of the list. +string. This is the address of the owner of the list. =cut -has admin => ( +has owner => ( is => 'ro', isa => Address, required => 1, @@ -43,7 +43,7 @@ has admin => ( around list_addresses => sub($orig,$self) { return +{ $self->$orig->%*, - admin => $self->admin, + owner => $self->owner, }; }; diff --git a/t/tests/sietima/multi-role/debounce-moderate.t b/t/tests/sietima/multi-role/debounce-moderate.t index 8612df0..e61c551 100644 --- a/t/tests/sietima/multi-role/debounce-moderate.t +++ b/t/tests/sietima/multi-role/debounce-moderate.t @@ -8,13 +8,13 @@ sub test_one($traits,$should_send=1) { 'one@users.example.com', 'two@users.example.com', ); - my $admin = 'admin@lists.example.com'; + my $owner = 'owner@lists.example.com'; my $ms = Test::Sietima::MailStore->new(); my $s = make_sietima( with_traits => $traits, subscribers => \@subscriber_addresses, - admin => $admin, + owner => $owner, mail_store => $ms, ); diff --git a/t/tests/sietima/role/headers.t b/t/tests/sietima/role/headers.t index 7b3e4b7..3052781 100644 --- a/t/tests/sietima/role/headers.t +++ b/t/tests/sietima/role/headers.t @@ -17,9 +17,9 @@ package Sietima::Role::ForTesting { }; my $s = make_sietima( - with_traits => ['Headers','WithAdmin','ForTesting'], + with_traits => ['Headers','WithOwner','ForTesting'], name => 'test-list', - admin => 'admin@example.com', + owner => 'owner@example.com', subscribers => [ 'one@users.example.com', 'two@users.example.com', @@ -33,7 +33,7 @@ subtest 'list headers should be added' => sub { object { call sub { +{ shift->header_str_pairs } } => hash { field 'List-Id' => 'test-list <sietima-test.list.example.com>'; - field 'List-Owner' => '<mailto:admin@example.com>'; + field 'List-Owner' => '<mailto:owner@example.com>'; field 'List-Post' => '<mailto:sietima-test@list.example.com>'; field 'List-Test1' => '<mailto:someone@example.com>'; field 'List-Test-2' => 'http://test.example.com'; diff --git a/t/tests/sietima/role/subscriberonly/moderate.t b/t/tests/sietima/role/subscriberonly/moderate.t index c4e3005..44999bd 100644 --- a/t/tests/sietima/role/subscriberonly/moderate.t +++ b/t/tests/sietima/role/subscriberonly/moderate.t @@ -7,12 +7,12 @@ my @subscriber_addresses = ( 'one@users.example.com', 'two@users.example.com', ); -my $admin = 'admin@lists.example.com'; +my $owner = 'owner@lists.example.com'; my $ms = Test::Sietima::MailStore->new(); my $s = make_sietima( with_traits => ['SubscriberOnly::Moderate'], subscribers => \@subscriber_addresses, - admin => $admin, + owner => $owner, mail_store => $ms, ); @@ -38,7 +38,7 @@ sub test_from_non_sub() { o => object { call [header_str => 'subject'] => match qr{\bheld for moderation\b}; call [header_str => 'from'] => match qr{\b\Q$from\E\b}; - call [header_str => 'to'] => match qr{\b\Q$admin\E\b}; + call [header_str => 'to'] => match qr{\b\Q$owner\E\b}; call_list parts => [ object { call body => match qr{Use id \S+ to refer to it}; @@ -51,7 +51,7 @@ sub test_from_non_sub() { ]; }, from => $from, - to => [$admin], + to => [$owner], }], ); } |