Commit 9080e8c6 authored by IKEDA Soji's avatar IKEDA Soji
Browse files

- Added options personalization.web_apply_on & personalization.mail_apply_on

- Renamed parameter "merge_feature" to "personalization_feature"
parent 67457ac1
......@@ -156,6 +156,8 @@ max_list_members editor hidden
message_hook owner hidden
message_hook privileged_owner read
personalization owner,privileged_owner read
default privileged_owner write
default owner write
default editor read
......
......@@ -14864,9 +14864,10 @@ sub do_send_mail {
$message->reformat_utf8_message([], $charset);
}
 
## Roughly check TT2 syntax for merge_feature.
if (Sympa::Tools::Data::smart_eq($list->{'admin'}{'merge_feature'}, 'on'))
{
# Roughly check TT2 syntax for personalization.
if ( 'on' eq ($list->{'admin'}{'personalization_feature'} || 'off')
and 'all' eq
($list->{'admin'}{'personalization'}{'web_apply_on'} || 'none')) {
my $new_message = $message->dup;
unless (defined $new_message->personalize($list)) {
# FIXME: Get last_error of template object.
......@@ -14905,9 +14906,12 @@ sub do_send_mail {
# - Add footer / header.
$u_message->prepare_message_according_to_mode('mail', $list);
# - Shelve personalization.
$u_message->{shelved}{merge} = 'all'
if Sympa::Tools::Data::smart_eq($list->{'admin'}{'merge_feature'},
'on');
if ( 'on' eq ($list->{'admin'}{'personalization_feature'} || 'off')
and 'none' ne
($list->{'admin'}{'personalization'}{'web_apply_on'} || 'none')) {
$u_message->{shelved}{merge} =
$list->{'admin'}{'personalization'}{'web_apply_on'};
}
 
$u_message->{envelope_sender} = Sympa::get_address($robot, 'owner');
$u_message->{priority} =
......
......@@ -1115,8 +1115,8 @@ our %pinfo = (
},
'max-size' => {obsolete => 'max_size'},
merge_feature => {
context => [qw(list site)],
personalization_feature => {
context => [qw(list domain site)],
order => 20.16,
group => 'sending', # outgoing / sending?
gettext_id => "Allow message personalization",
......@@ -1124,6 +1124,36 @@ our %pinfo = (
occurrence => '1',
default => 'off',
},
merge_feature => {obsolete => 'personalization_feature'},
personalization => {
context => [qw(list domain site)],
order => 20.161,
group => 'sending',
gettext_id => "Message personalization",
format => {
web_apply_on => {
context => [qw(list domain site)],
order => 1,
group => 'sending',
gettext_id =>
'which part of message from web conversion is applied',
format => ['none', 'footer', 'all'],
default => 'footer',
occurrence => '1'
},
mail_apply_on => {
context => [qw(list domain site)],
order => 2,
group => 'sending',
gettext_id =>
'which part of e-mail message conversion is applied',
format => ['none', 'footer', 'all'],
default => 'none',
occurrence => '1'
},
},
},
message_hook => {
context => [qw(list)],
......
......@@ -44,7 +44,8 @@ our %list_option = (
'list' => {'gettext_id' => 'list'},
# include_ldap_2level_query.select2, include_ldap_2level_query.select1,
# include_ldap_query.select, reply_to_header.value, dmarc_protection.mode
# include_ldap_query.select, reply_to_header.value, dmarc_protection.mode,
# personalization.web_apply_on, personalization.mail_apply_on
'all' => {'gettext_id' => 'all'},
# reply_to_header.value
......@@ -55,10 +56,14 @@ our %list_option = (
'body' => {'gettext_id' => 'message body'},
'subject_and_body' => {'gettext_id' => 'subject and body'},
# personalization.web_apply_on, personalization.mail_apply_on
'footer' => {'gettext_id' => 'header and footer'},
# bouncers_level2.notification, bouncers_level2.action,
# bouncers_level1.notification, bouncers_level1.action,
# spam_protection, dkim_signature_apply_on, web_archive_spam_protection,
# dmarc_protection.mode, automatic_list_removal
# dmarc_protection.mode, automatic_list_removal,
# personalization.web_apply_on, personalization.mail_apply_on
'none' => {'gettext_id' => 'do nothing'},
# automatic_list_removal
......
......@@ -408,9 +408,14 @@ sub _mail_message {
# Shelve personalization if not yet shelved.
# Note that only 'footer' mode will be allowed unless otherwise requested.
$message->{shelved}{merge} ||= 'footer'
if Sympa::Tools::Data::smart_eq($list->{'admin'}{'merge_feature'},
'on');
if ( not $message->{shelved}{merge}
and 'on' eq ($list->{'admin'}{'personalization_feature'} || 'off')
and 'none' ne
($list->{'admin'}{'personalization'}{'mail_apply_on'} || 'none')) {
$message->{shelved}{merge} =
$list->{'admin'}{'personalization'}{'mail_apply_on'};
}
# Shelve re-encryption with S/MIME.
$message->{shelved}{smime_encrypt} = 1
if $message->{'smime_crypted'};
......
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