Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistencies in implementation and documentation of typical list profile (create list templates) #157

Merged
merged 4 commits into from
Jan 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions default/create_list_templates/confidential/config.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ owner
[% FOREACH e = editor -%]
editor
email [% e.email %]
[% IF e.gecos -%]
gecos [% e.gecos %]
[% END %]

[% END %]
[% END %]
Expand Down
3 changes: 3 additions & 0 deletions default/create_list_templates/hotline/config.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ owner_include
[% FOREACH e = editor -%]
editor
email [% e.email %]
[% IF e.gecos -%]
gecos [% e.gecos %]
[% END %]

[% END -%]
[% END %]
Expand Down
3 changes: 3 additions & 0 deletions default/create_list_templates/html-news-letter/config.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ owner_include
[% FOREACH e = editor -%]
editor
email [% e.email %]
[% IF e.gecos -%]
gecos [% e.gecos %]
[% END %]

[% END -%]
[% END %]
Expand Down
3 changes: 3 additions & 0 deletions default/create_list_templates/intranet_list/config.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ owner_include
[% FOREACH e = editor -%]
editor
email [% e.email %]
[% IF e.gecos -%]
gecos [% e.gecos %]
[% END %]

[% END %]
[% END %]
Expand Down
3 changes: 3 additions & 0 deletions default/create_list_templates/news-letter/config.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ owner_include
[% FOREACH e = editor -%]
editor
email [% e.email %]
[% IF e.gecos -%]
gecos [% e.gecos %]
[% END %]

[% END %]
[% END %]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ owner_include
[% FOREACH e = editor -%]
editor
email [% e.email %]
[% IF e.gecos -%]
gecos [% e.gecos %]
[% END %]

[% END %]
[% END %]
Expand Down
3 changes: 3 additions & 0 deletions default/create_list_templates/public_web_forum/config.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ owner_include
[% FOREACH e = editor -%]
editor
email [% e.email %]
[% IF e.gecos -%]
gecos [% e.gecos %]
[% END %]

[% END %]
[% END %]
Expand Down
2 changes: 1 addition & 1 deletion src/cgi/wwsympa.fcgi.in
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ our %required_args = (
## other required parameters are checked in the subroutine
'create_automatic_list' => ['param.user.email', 'family'],
'create_automatic_list_request' => ['param.user.email', 'family'],
'create_list' => ['param.user.email'],
'create_list' => ['param.user.email', 'info'],
'create_list_request' => ['param.user.email'],
#XXX'css' => [],
'd_admin' => ['param.list', 'param.user.email'],
Expand Down
18 changes: 18 additions & 0 deletions src/lib/Sympa/Family.pm
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,12 @@ sub modify_list {
}

my $hash_list = $config->getHash();
# Compatibility: single topic on 6.2.24 or earlier.
$hash_list->{config}{topics} ||= $hash_list->{config}{topic};
# In old documentation "moderator" was single or multiple editors.
my $mod = $hash_list->{config}{moderator};
$hash_list->{config}{editor} ||=
(ref $mod eq 'ARRAY') ? $mod : (ref $mod eq 'HASH') ? [$mod] : [];

#getting list
my $list;
Expand Down Expand Up @@ -874,6 +880,12 @@ sub instantiate {

## stores the list config into the hash referenced by $hash_list.
my $hash_list = $config->getHash();
# Compatibility: single topic on 6.2.24 or earlier.
$hash_list->{config}{topics} ||= $hash_list->{config}{topic};
# In old documentation "moderator" was single or multiple editors.
my $mod = $hash_list->{config}{moderator};
$hash_list->{config}{editor} ||=
(ref $mod eq 'ARRAY') ? $mod : (ref $mod eq 'HASH') ? [$mod] : [];

if ($list) {
## LIST ALREADY EXISTING
Expand Down Expand Up @@ -1056,6 +1068,12 @@ sub instantiate {
next;
}
my $hash_list = $config->getHash();
# Compatibility: single topic on 6.2.24 or earlier.
$hash_list->{config}{topics} ||= $hash_list->{config}{topic};
# In old documentation "moderator" was single or multiple editors.
my $mod = $hash_list->{config}{moderator};
$hash_list->{config}{editor} ||=
(ref $mod eq 'ARRAY') ? $mod : (ref $mod eq 'HASH') ? [$mod] : [];

my $result = $self->_update_existing_list($list, $hash_list);
unless (defined $result) {
Expand Down
8 changes: 6 additions & 2 deletions src/lib/Sympa/Request/Handler/create_list.pm
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ sub _twist {
my $sender = $request->{sender};

# Obligatory parameters.
foreach my $arg (qw(subject template description topics)) {
foreach my $arg (qw(subject template topics)) {
unless (defined $param->{$arg} and $param->{$arg} =~ /\S/) {
$self->add_stash($request, 'user', 'missing_arg',
{argument => $arg});
Expand All @@ -67,7 +67,11 @@ sub _twist {
}
}
# The 'other' topic means no topic.
delete $request->{topics} if $request->{topics} eq 'other';
$param->{topics} = lc $param->{topics};
delete $param->{topics} if $param->{topics} eq 'other';
# Sanytize editor.
$param->{editor} =
[grep { ref $_ eq 'HASH' and $_->{email} } @{$param->{editor} || []}];

# owner.email || owner_include.source
_check_owner_defined($param);
Expand Down
12 changes: 12 additions & 0 deletions src/sbin/sympa.pl.in
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,12 @@ if ($main::options{'dump'}) {
exit 1;
}
my $hash = $config->getHash();
# Compatibility: single topic on 6.2.24 or earlier.
$hash->{config}{topics} ||= $hash->{config}{topic};
# In old documentation "moderator" was single or multiple editors.
my $mod = $hash->{config}{moderator};
$hash->{config}{editor} ||=
(ref $mod eq 'ARRAY') ? $mod : (ref $mod eq 'HASH') ? [$mod] : [];

my $spindle = Sympa::Spindle::ProcessRequest->new(
context => $robot,
Expand Down Expand Up @@ -683,6 +689,12 @@ if ($main::options{'dump'}) {
exit 1;
}
my $hash = $config->getHash();
# Compatibility: single topic on 6.2.24 or earlier.
$hash->{config}{topics} ||= $hash->{config}{topic};
# In old documentation "moderator" was single or multiple editors.
my $mod = $hash->{config}{moderator};
$hash->{config}{editor} ||=
(ref $mod eq 'ARRAY') ? $mod : (ref $mod eq 'HASH') ? [$mod] : [];

my $spindle = Sympa::Spindle::ProcessRequest->new(
context => $family,
Expand Down