Commit 11b54d4a authored by IKEDA Soji's avatar IKEDA Soji
Browse files

More refactoring for PR#1251

parent 3803f0fb
......@@ -6874,13 +6874,6 @@ sub do_import {
#);
#return $next_action unless $next_action eq '1';
 
unless ($list->is_subscription_allowed) {
wwslog('info', 'List %s not open', $list);
add_stash('user', 'list_not_open',
{'status' => $list->{'admin'}{'status'}});
return $in{'previous_action'} || 'review';
}
my (@emails, @dnames);
foreach (split /\r\n|\r|\n/, $content) {
next unless /\S/;
......@@ -6950,13 +6943,6 @@ sub do_add {
);
return $next_action unless $next_action eq '1';
 
unless ($list->is_subscription_allowed) {
wwslog('info', 'List %s not open', $list);
add_stash('user', 'list_not_open',
{'status' => $list->{'admin'}{'status'}});
return $in{'previous_action'} || 'review';
}
my $stash = [];
my $processed = 0;
foreach my $email (@emails) {
......@@ -7066,13 +7052,6 @@ sub do_del {
);
return $next_action unless $next_action eq '1';
 
unless ($list->is_subscription_allowed) {
wwslog('info', 'List %s not open', $list);
add_stash('user', 'list_not_open',
{'status' => $list->{'admin'}{'status'}});
return $in{'previous_action'} || 'review';
}
my $stash = [];
my $processed = 0;
foreach my $email (@emails) {
......
......@@ -80,6 +80,7 @@ sub _twist {
$log->syslog('info', 'List %s not open', $list);
$self->add_stash($request, 'user', 'list_not_open',
{'status' => $list->{'admin'}{'status'}});
$self->{finish} = 1;
return undef;
}
if (Sympa::Tools::Domains::is_blocklisted($email)) {
......
......@@ -66,6 +66,7 @@ sub _twist {
$log->syslog('info', 'List %s not open', $list);
$self->add_stash($request, 'user', 'list_not_open',
{'status' => $list->{'admin'}{'status'}});
$self->{finish} = 1;
return undef;
}
......
......@@ -93,6 +93,7 @@ unless (
'open_list=s', 'show_pending_lists=s',
'notify', 'rebuildarc=s',
'add=s', 'del=s',
'force|F',
)
) {
pod2usage(-exitval => 1, -output => \*STDERR);
......@@ -517,11 +518,6 @@ if ($main::options{'dump'} or $main::options{'dump_users'}) {
exit 1;
}
unless ($main::options{force} or $list->is_subscription_allowed) {
printf STDERR "List %s not open\n", $main::options{'add'};
exit 1;
}
$main::options{'role'} //= 'member';
unless (grep {$main::options{'role'} eq $_} qw(member owner editor)) {
printf STDERR "Unknown role \"%s\".\n", $main::options{'role'};
......@@ -549,7 +545,7 @@ if ($main::options{'dump'} or $main::options{'dump_users'}) {
role => $main::options{'role'},
email => [@emails],
gecos => [@dnames],
force => 1,
force => $main::options{'force'},
quiet => $main::options{'quiet'},
notify => $main::options{'notify'},
sender => Sympa::get_address($list, 'listmaster'),
......@@ -574,11 +570,6 @@ if ($main::options{'dump'} or $main::options{'dump_users'}) {
exit 1;
}
unless ($main::options{force} or $list->is_subscription_allowed) {
printf STDERR "List %s not open\n", $main::options{'del'};
exit 1;
}
$main::options{'role'} //= 'member';
unless (grep {$main::options{'role'} eq $_} qw(member owner editor)) {
printf STDERR "Unknown role \"%s\".\n", $main::options{'role'};
......@@ -604,7 +595,7 @@ if ($main::options{'dump'} or $main::options{'dump_users'}) {
action => 'del',
role => $main::options{'role'},
email => [@emails],
force => 1,
force => $main::options{'force'},
quiet => $main::options{'quiet'},
notify => $main::options{'notify'},
sender => Sympa::get_address($list, 'listmaster'),
......
......@@ -117,8 +117,8 @@ my $editor3 =
do_test(
request => {
action => 'add',
email => $member1->[0],
gecos => $member1->[1],
email => [$member1->[0], $member2->[0],],
gecos => [$member1->[1], $member2->[1],],
},
result => [[qw(user list_not_open)]],
data => [],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment