aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2017-01-04 16:07:14 +0000
committerdakkar <dakkar@thenautilus.net>2017-01-04 16:07:41 +0000
commit3efd2284c8fd21c0a828b1ce5be913a83682019e (patch)
treed803a97e89ee788544e4dc0e32b15d7eeba5b694
parentbugs from live testing (diff)
downloadSietima-3efd2284c8fd21c0a828b1ce5be913a83682019e.tar.gz
Sietima-3efd2284c8fd21c0a828b1ce5be913a83682019e.tar.bz2
Sietima-3efd2284c8fd21c0a828b1ce5be913a83682019e.zip
fix&test malformed moderation email
-rw-r--r--TODO.md1
-rw-r--r--lib/Sietima/Role/SubscriberOnly/Moderate.pm4
-rw-r--r--t/lib/Test/Sietima.pm1
-rw-r--r--t/tests/sietima/role/subscriberonly/moderate.t4
4 files changed, 7 insertions, 3 deletions
diff --git a/TODO.md b/TODO.md
index 487e90b..c47b836 100644
--- a/TODO.md
+++ b/TODO.md
@@ -4,7 +4,6 @@
* messy permissions, we should set some umask (we'd like
group-writable mailstore)
* `Moderate`+`Debounce` means resuming fails to send
- * moderation notice email is badly formed
* maybe auto-mkpath for `::MailStore::FS`?
* list footer
* append to plain text single part
diff --git a/lib/Sietima/Role/SubscriberOnly/Moderate.pm b/lib/Sietima/Role/SubscriberOnly/Moderate.pm
index 8bfef2f..966f2d3 100644
--- a/lib/Sietima/Role/SubscriberOnly/Moderate.pm
+++ b/lib/Sietima/Role/SubscriberOnly/Moderate.pm
@@ -12,8 +12,8 @@ with 'Sietima::Role::SubscriberOnly',
sub munge_mail_from_non_subscriber ($self,$mail) {
my $id = $self->mail_store->store($mail,'moderation');
my $notice = Email::Stuffer
- ->from($self->return_path)
- ->to($self->admin)
+ ->from($self->return_path->address)
+ ->to($self->admin->address)
->subject("Message held for moderation - ".$mail->header_str('subject'))
->text_body("Use id $id to refer to it")
->attach($mail->as_string, content_type => 'message/rfc822');
diff --git a/t/lib/Test/Sietima.pm b/t/lib/Test/Sietima.pm
index d7b720c..a94a51c 100644
--- a/t/lib/Test/Sietima.pm
+++ b/t/lib/Test/Sietima.pm
@@ -86,6 +86,7 @@ sub deliveries_are (%args) {
field to => bag {
item $_ for $m->{to}->@*;
};
+ field from => $m->{from} if $m->{from};
etc();
};
}
diff --git a/t/tests/sietima/role/subscriberonly/moderate.t b/t/tests/sietima/role/subscriberonly/moderate.t
index be996e3..c4e3005 100644
--- a/t/tests/sietima/role/subscriberonly/moderate.t
+++ b/t/tests/sietima/role/subscriberonly/moderate.t
@@ -30,12 +30,15 @@ subtest 'from subscriber' => sub {
};
sub test_from_non_sub() {
+ my $from = $s->return_path->address;
test_sending(
sietima => $s,
mail => { from=>'someone@users.example.com' },
mails => [{
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_list parts => [
object {
call body => match qr{Use id \S+ to refer to it};
@@ -47,6 +50,7 @@ sub test_from_non_sub() {
},
];
},
+ from => $from,
to => [$admin],
}],
);