Commit d52c0bec authored by IKEDA Soji's avatar IKEDA Soji
Browse files

[-bug] Inconsistent definition of topics list parameter.

It should be the set of topics names but defined as array of scalars.
parent 22f9459f
......@@ -12678,10 +12678,10 @@ sub _prepare_edit_form {
$p->{'type'} = 'enum';
 
my @topics;
foreach my $topic (@{$p->{'value'}}) {
push @topics, $topic->{'value'};
foreach my $topic (sort keys %{$p->{'value'}}) {
push @topics, $topic if $p->{'value'}{$topic}{'selected'};
}
undef $p->{'value'};
delete $p->{'value'};
my %list_of_topics = Sympa::Robot::load_topics($robot);
 
if (defined $p->{'constraint'}) {
......
......@@ -228,7 +228,7 @@ our %pinfo = (
'topics' => {
'group' => 'description',
'gettext_id' => "Topics for the list",
'format' => '[\-\w]+(\/[\-\w]+)?',
'format' => [], # Sympa::Robot::load_topics() called later
'split_char' => ',',
'occurrence' => '0-n'
},
......@@ -2490,7 +2490,6 @@ Some of them can include other type of nodes recursively.
=item *
{format}: Arrayref.
Or, it is regexp and {split_char} is defined.
=back
......@@ -2510,10 +2509,6 @@ The set cannot contain paragraphs, sets or arrays.
{format}: Regexp or hashref.
=item *
{split_char}: Not defined.
=back
List of the same type of nodes in order.
......
......@@ -369,7 +369,24 @@ sub list_params {
my $robot_id = shift;
my $pinfo = Sympa::Tools::Data::clone_var(\%Sympa::ListDef::pinfo);
$pinfo->{'lang'}{'format'} = [Sympa::get_supported_languages($robot_id)];
$pinfo->{lang}{format} = [Sympa::get_supported_languages($robot_id)];
my %topics = Sympa::Robot::load_topics($robot_id);
my @topics = map {
my $topic = $_;
if ($topics{$topic}->{sub}) {
( $topic,
map { $topic . '/' . $_ } sort keys %{$topics{$topic}->{sub}}
);
} else {
($topic);
}
} sort keys %topics;
$pinfo->{topics}{format} = [@topics];
# Compat.
$pinfo->{topics}{file_format} = sprintf '(%s)(,(%s))*',
join('|', @topics),
join('|', @topics);
return $pinfo;
}
......
Supports Markdown
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