Commit 41097c02 authored by IKEDA Soji's avatar IKEDA Soji
Browse files

Now the list parameter member_include may have reception & visibility as...

Now the list parameter member_include may have reception & visibility as owner_include & editor_include do (#989).

Parameters to specify defaults (profile, reception & visibility) in *_include parameters may be optional and values in corresponding default_*_options parameters will be used as the defaults.
parent a1cf5458
......@@ -2818,6 +2818,31 @@ our %pinfo = (
format => '.*',
occurrence => '0-1'
},
reception => {
context => [qw(list)],
order => 3,
gettext_id => "reception mode",
gettext_comment => 'Mail reception mode.',
format => [
'mail', 'notice', 'digest', 'digestplain',
'summary', 'nomail', 'txt', 'urlize',
'not_me'
],
synonym => {'html' => 'mail'},
field_type => 'reception',
occurrence => '0-1', # See default_user_options
not_before => '6.2.67b.2',
},
visibility => {
context => [qw(list)],
order => 4,
gettext_id => "visibility",
gettext_comment => 'Visibility of the subscriber.',
format => ['conceal', 'noconceal'],
field_type => 'visibility',
occurrence => '0-1', # See default_user_options
not_before => '6.2.67b.2',
}
},
occurrence => '0-n'
},
......@@ -2827,6 +2852,7 @@ our %pinfo = (
order => 60.02_1,
group => 'data_source',
gettext_id => 'Owners defined in an external data source',
not_before => '4.2b.5',
format => {
source => {
context => [qw(list)],
......@@ -2839,6 +2865,7 @@ our %pinfo = (
context => [qw(list)],
order => 2,
gettext_id => 'data source parameters',
not_before => '5.0a',
format => '.*',
occurrence => '0-1'
},
......@@ -2847,24 +2874,22 @@ our %pinfo = (
order => 3,
gettext_id => 'profile',
format => ['privileged', 'normal'],
occurrence => '1',
default => 'normal'
occurrence => '0-1', # See default_owner_options
},
reception => {
context => [qw(list)],
order => 4,
gettext_id => 'reception mode',
format => ['mail', 'nomail'],
occurrence => '1',
default => 'mail'
occurrence => '0-1', # See default_owner_options
},
visibility => {
context => [qw(list)],
order => 5,
gettext_id => "visibility",
not_before => '5.4a.6',
format => ['conceal', 'noconceal'],
occurrence => '1',
default => 'noconceal'
occurrence => '0-1', # See default_owner_options
},
},
occurrence => '0-n'
......@@ -2875,6 +2900,7 @@ our %pinfo = (
order => 60.02_2,
group => 'data_source',
gettext_id => 'Moderators defined in an external data source',
not_before => '4.2b.5',
format => {
source => {
context => [qw(list)],
......@@ -2887,6 +2913,7 @@ our %pinfo = (
context => [qw(list)],
order => 2,
gettext_id => 'data source parameters',
not_before => '5.0a',
format => '.*',
occurrence => '0-1'
},
......@@ -2895,16 +2922,15 @@ our %pinfo = (
order => 3,
gettext_id => 'reception mode',
format => ['mail', 'nomail'],
occurrence => '1',
default => 'mail'
occurrence => '0-1', # See default_editor_options
},
visibility => {
context => [qw(list)],
order => 5,
gettext_id => "visibility",
not_before => '5.4a.6',
format => ['conceal', 'noconceal'],
occurrence => '1',
default => 'noconceal'
occurrence => '0-1', # See default_editor_options
}
},
occurrence => '0-n'
......
......@@ -61,10 +61,23 @@ sub new {
die 'bug in logic. Ask developer' unless ref $list eq 'Sympa::List';
}
# Get default user options from data source definition.
my %defopts;
if (grep { $role eq $_ } qw(member owner editor)) {
%defopts =
map { ($_ => $options{$_}) }
grep { defined $options{$_} }
keys %{$list->get_default_user_options(role => $role)};
}
$options{name} = Sympa::Tools::Text::clip($options{name}, 50)
if 50 < length($options{name} // '');
my $self = $type->_new(%options, _role => $role,);
my $self = $type->_new(
%options,
_role => $role,
default_user_options => {%defopts},
);
$self->{_external} = not($self->isa('Sympa::DataSource::List')
and [split /\@/, $self->{listname}, 2]->[1] eq $list->{'domain'})
if ref $list eq 'Sympa::List';
......
......@@ -477,6 +477,7 @@ sub _update_users {
my @list_of_new_users = map {
my ($email, $gecos) = @$_;
my $user = {
%{$ds->{default_user_options} // {}},
email => $email,
gecos => $gecos,
subscribed => 0,
......
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