diff --git a/src/lib/Sympa/Config/Schema.pm b/src/lib/Sympa/Config/Schema.pm index 16edc26346..4e9b78e489 100644 --- a/src/lib/Sympa/Config/Schema.pm +++ b/src/lib/Sympa/Config/Schema.pm @@ -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' diff --git a/src/lib/Sympa/DataSource.pm b/src/lib/Sympa/DataSource.pm index db4ab6cfea..bb87745ab8 100644 --- a/src/lib/Sympa/DataSource.pm +++ b/src/lib/Sympa/DataSource.pm @@ -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'; diff --git a/src/lib/Sympa/Request/Handler/include.pm b/src/lib/Sympa/Request/Handler/include.pm index a8e7bc48ab..8d4475c9c3 100644 --- a/src/lib/Sympa/Request/Handler/include.pm +++ b/src/lib/Sympa/Request/Handler/include.pm @@ -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,