package Sietima::Role::ManualSubscription;
use Moo::Role;
use Sietima::Policy;
use URI;
use namespace::clean;
our $VERSION = '1.0.0';
with 'Sietima::Role::WithOwner';
around list_addresses => sub($orig,$self) {
my $list_name = $self->name // 'the list';
my $mail_owner_uri = URI->new($self->owner,'mailto');
my $sub_uri = $mail_owner_uri->clone;
$sub_uri->query_form(subject => "Please add me to $list_name");
my $unsub_uri = $mail_owner_uri->clone;
$unsub_uri->query_form(subject => "Please remove me from $list_name");
return +{
$self->$orig->%*,
subscribe => $sub_uri,
unsubscribe => $unsub_uri,
};
};
1;
__END__