Unverified Commit aafa9834 authored by IKEDA Soji's avatar IKEDA Soji Committed by GitHub
Browse files

Revert "list index performance update for wwsympa.fcgi do_lists subroutine (#925)"

parent 13af5d06
......@@ -4196,9 +4196,9 @@ sub do_lists {
my @lists;
wwslog('info', '(%s, %s)', $in{'topic'}, $in{'subtopic'});
 
# Get member/owner/editor data used to avoid lookups in the loop
my $which = {member => {}, owner => {}, editor => {}};
if ($param->{'user'}{'email'}) {
my $all_lists = [];
if ($in{'topic'} and $in{'topic'} eq '@which') {
my %lists = ();
foreach my $role ('member', 'owner', 'editor') {
foreach my $list (
Sympa::List::get_which(
......@@ -4206,16 +4206,6 @@ sub do_lists {
$robot, $role
)
) {
$which->{$role}->{$list->{'name'}} = $list;
}
}
}
my $all_lists = [];
if ($in{'topic'} and $in{'topic'} eq '@which') {
my %lists = ();
foreach my $role ('member', 'owner', 'editor') {
foreach my $list (values %{$which->{$role}}) {
$lists{$list->{'name'}} = $list;
}
}
......@@ -4240,7 +4230,6 @@ sub do_lists {
 
foreach my $list (@$all_lists) {
my $sender = $param->{'user'}{'email'} || 'nobody';
my $listname = $list->{'name'};
 
my $result =
Sympa::Scenario->new($list, 'visibility',
......@@ -4265,34 +4254,32 @@ sub do_lists {
#Compat.<6.2.32
$list_info->{'host'} = $list->{'domain'};
 
if ($param->{'user'}{'email'}) {
if ($which->{owner}->{$listname}) {
if ($list->is_admin(
'privileged_owner', $param->{'user'}{'email'}
)
) {
$list_info->{is_privileged_owner} = 1;
}
if (not $which->{editor}->{$listname}
and $list->is_admin(
'actual_editor', $param->{'user'}{'email'}
)
) {
$list_info->{is_editor} = 1;
}
$list_info->{is_owner} = 1;
# Compat. < 6.2b.2.
$list_info->{'admin'} = 1;
}
if ($which->{editor}->{$listname}) {
$list_info->{is_editor} = 1;
# Compat. < 6.2b.2.
$list_info->{'admin'} = 1;
}
if ($which->{member}->{$listname}) {
$list_info->{'is_subscriber'} = 1;
}
if ( $param->{'user'}{'email'}
and
$list->is_admin('privileged_owner', $param->{'user'}{'email'})) {
$list_info->{'is_privileged_owner'} = 1;
$list_info->{'is_owner'} = 1;
# Compat. < 6.2b.2.
$list_info->{'admin'} = 1;
}
if ( $param->{'user'}{'email'}
and $list->is_admin('owner', $param->{'user'}{'email'})) {
$list_info->{'is_owner'} = 1;
# Compat. < 6.2b.2.
$list_info->{'admin'} = 1;
}
if ( $param->{'user'}{'email'}
and $list->is_admin('actual_editor', $param->{'user'}{'email'})) {
$list_info->{'is_editor'} = 1;
# Compat. < 6.2b.2.
$list_info->{'admin'} = 1;
}
if ( $param->{'user'}{'email'}
and $list->is_list_member($param->{'user'}{'email'})) {
$list_info->{'is_subscriber'} = 1;
}
my $listname = $list->{'name'};
 
$param->{'which'} ||= {};
$param->{'which'}{$listname} = $list_info;
......
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