Skip to content

Commit

Permalink
Merge pull request sympa-community#330 from ikedas/optioal_wwsympa_ur…
Browse files Browse the repository at this point in the history
…l by ikedas

WWSympa: wwsympa_url would be optional
  • Loading branch information
ikedas authored Jun 6, 2018
2 parents e491c80 + 97d893a commit c7362de
Show file tree
Hide file tree
Showing 18 changed files with 130 additions and 44 deletions.
2 changes: 2 additions & 0 deletions default/mail_tt2/automatic_bounce_management.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ Subject: [% FILTER qencode %][%|loc(list.name)%]List %1 automatic bounce managem
[% user %]
[% END %]

[% IF conf.wwsympa_url -%]
[%|loc%]Managing bouncing subscribers:[%END%] [% 'reviewbouncing' | url_abs([list.name]) %]
[% END -%]
2 changes: 2 additions & 0 deletions default/mail_tt2/command_report.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,6 @@ X-Loop: [% conf.email %]@[% domain %]

-----------==========================================-----------

[% IF conf.wwsympa_url -%]
[%|loc(conf.wwsympa_url)%]For further information, check the mailing list web site %1[%END%]
[% END -%]
20 changes: 12 additions & 8 deletions default/mail_tt2/expire_warning1.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@
Subject: [% FILTER qencode %][%|loc(list.name)%]resubscription to %1[%END%][%END%]

[%|loc(list.name,domain,user.email)%]You have been subscriber of list %1@%2 with email %3 for 1 year or more.[%END%]
[% | mailtourl({subject => "sub ${list.name}"}) ~%]
[% conf.email %]@[% domain %]
[%~ END %]
[% "${conf.email}@${domain}" | mailtourl({subject => "sub ${list.name}"}) %]

[%|loc%]Everything about this list: [%END%][% 'info' | url_abs([list.name]) %]
[%|loc%]Unsubscription:[%END%]
[% | mailtourl({subject => "sig ${list.name} ${user.email}"}) ~%]
[% conf.email %]@[% domain %]
[%~ END %]
[% IF conf.wwsympa_url -%]
[%|loc%]Everything about this list: [%END ~%]
[% 'info' | url_abs([list.name]) %]
[%|loc%]Unsubscription:[%END%] [%""~%]
[% 'signoff' | url_abs([list.name]) %]
[% ELSE -%]
[%|loc%]Information about this list: [%END ~%]
[% "${conf.email}@${domain}" | mailtourl({subject => "info ${list.name}"}) %]
[%|loc%]Unsubscription:[%END%] [%""~%]
[% "${conf.email}@${domain}" | mailtourl({subject => "sig ${list.name} ${user.email}"}) %]
[% END -%]
20 changes: 12 additions & 8 deletions default/mail_tt2/expire_warning2.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ From: [% fromlist %]
Subject: [% FILTER qencode %][%|loc(list.name)%]resubscription to %1[%END%][%END%]

[%|loc(list.name,domain,user.email)%]You have been subscriber of list %1@%2 with email %3 for 1 year or more.[%END%]
[% | mailtourl({subject => "sub ${list.name}"}) ~%]
[% conf.email %]@[% domain %]
[%~ END %]
[% "${conf.email}@${domain}" | mailtourl({subject => "sub ${list.name}"}) %]

[%|loc%]Everything about this list: [%END%][% 'info' | url_abs([list.name]) %]
[%|loc%]Unsubscription:[%END%]
[% | mailtourl({subject => "sig ${list.name} ${user.email}"}) ~%]
[% conf.email %]@[% domain %]
[%~ END %]
[% IF conf.wwsympa_url -%]
[%|loc%]Everything about this list: [%END ~%]
[% 'info' | url_abs([list.name]) %]
[%|loc%]Unsubscription:[%END%] [%""~%]
[% 'signoff' | url_abs([list.name]) %]
[% ELSE -%]
[%|loc%]Information about this list: [%END ~%]
[% "${conf.email}@${domain}" | mailtourl({subject => "info ${list.name}"}) %]
[%|loc%]Unsubscription:[%END%] [%""~%]
[% "${conf.email}@${domain}" | mailtourl({subject => "sig ${list.name} ${user.email}"}) %]
[% END -%]
12 changes: 5 additions & 7 deletions default/mail_tt2/invite.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ Subject: [% FILTER qencode %][%|loc(list.name)%]Invitation to join list %1[%END%
[%|loc(list.subject)%]This list is about %1, so you are probably concerned.[%END%]

[%|loc%]To subscribe, click the following URL:[%END%]
[% IF user_interfaces.size() == 1 && user_interfaces.0 == 'mail' -%]
[% | mailtourl({subject => "AUTH ${keyauth} ${cmd}"}) ~%]
[% conf.email %]@[% domain %]
[%~ END %]
[% IF conf.wwsympa_url -%]
[% 'auth' | url_abs([keyauth,'subscribe',list.name],{email=>user.email}) %]
[%~ ELSE -%]
[% "${conf.email}@${domain}" | mailtourl({subject => "AUTH ${keyauth} ${cmd}"}) %]

[%|loc(conf.email,domain)%]Or send a message to %1@%2 with the following subject:[%END%]
AUTH [% keyauth %] [% cmd %]
[%- ELSE -%]
[% 'auth' | url_abs([keyauth,'subscribe'],{email=>user.email}) %]
[%- END %]
[%~ END -%]

[%|loc%]If you don't want to subscribe just ignore this message.[%END%]
2 changes: 2 additions & 0 deletions default/mail_tt2/list_created.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ Subject: [% FILTER qencode %][%|loc(list.name)%]%1 mailing list creation[%END%][

[%|loc(list.name,domain)%]%1@%2 mailing list has been activated by listmaster.[%END%]

[% IF conf.wwsympa_url -%]
[%|loc%]homepage[%END%]
[% 'info' | url_abs([list.name]) %]

[%|loc(list.name)%]%1 admin page[%END%]
[% 'admin' | url_abs([list.name]) %]
[% END -%]
3 changes: 2 additions & 1 deletion default/mail_tt2/reject.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Subject: [% FILTER qencode %][%|loc%]Your message has been rejected[%END%][%END%

[%|loc(subject)%](Subject of your mail: %1)[%END%]


[% IF conf.wwsympa_url -%]
[%|loc(list.name)%]Check %1 list usage:[%END%]
[% 'info' | url_abs([list.name]) %]
[% END -%]
18 changes: 11 additions & 7 deletions default/mail_tt2/remind.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ Subject: [% FILTER qencode %][%|loc(list.name)%]Reminder of your subscription to

[%|loc%]It is important to us to not send mail to people that don't want to receive it. If you do not want to be on this mailing list, please follow the instructions below to remove yourself.[%END%]

[%|loc%]List information: [%END%][% 'info' | url_abs([list.name]) %]
[% IF subscriber.included != 1 %]
[%|loc%]To unsubscribe:[%END%]
[% | mailtourl({subject => "sig ${list.name} ${user.email}"}) ~%]
[% conf.email %]@[% domain %]
[%~ END %]
[%END%]
[% IF conf.wwsympa_url -%]
[%|loc%]List information: [%END ~%]
[% 'info' | url_abs([list.name]) %]
[%|loc%]To unsubscribe:[%END%] [%""~%]
[% 'signoff' | url_abs([list.name]) %]
[% ELSE -%]
[%|loc%]List information: [%END ~%]
[% "${conf.email}@${domain}" | mailtourl({subject => "info ${list.name}"}) %]
[%|loc%]To unsubscribe:[%END%] [%""~%]
[% "${conf.email}@${domain}" | mailtourl({subject => "sig ${list.name} ${user.email}"}) %]
[% END -%]
2 changes: 1 addition & 1 deletion default/mail_tt2/request_auth.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Subject: [% FILTER qencode %]AUTH [%keyauth%] [%cmd%][%END%]

[%- END -%]

[% IF user_interfaces.size() == 1 and user_interfaces.0 == 'mail' -%]
[% IF not conf.wwsympa_url -%]
[% sympa = BLOCK %][% conf.email %]@[% domain %][%END -%]
[%|loc(sympa,"AUTH ${keyauth} ${cmd}") %]If you want this action to be taken, please

Expand Down
2 changes: 2 additions & 0 deletions default/mail_tt2/user_notification.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ Subject: [% FILTER qencode %][%|loc(list.name)%]Management of list %1[%END%][%EN
[%|loc(delegator,list.name,domain)%]You have been delegated the responsability of list moderator by %1 for list %2@%3.[%END%]
[% END %]

[% IF conf.wwsympa_url -%]
[%|loc%]The list homepage:[%END%] [% 'info' | url_abs([list.name]) %]
[%|loc%]Owner and moderator guide:[%END%] [% 'help/admin' | url_abs %]
[% END -%]

[% ELSIF type == 'ticket_to_family_signoff' -%]
Subject: [% FILTER qencode %][%|loc(family)%]Unsubscribing from family %1[%END%][%END%]
Expand Down
3 changes: 2 additions & 1 deletion default/mail_tt2/welcome.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Subject: [% FILTER qencode %][%|loc(list.name)%]Welcome to list %1[%END%][%END%]
[% CATCH %]
[% END %]

[% IF conf.wwsympa_url -%]
[%|loc%]The list homepage:[%END%] [% 'info' | url_abs([list.name]) %]
[%|loc%]General informations about mailing lists:[%END%] [% 'help/introduction' | url_abs %]

[% END -%]
2 changes: 2 additions & 0 deletions default/mail_tt2/x509-user-cert-missing.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ Subject: %2[%END%]
[%|loc(user.email)%]It was not possible to send you the message because the mailing list manager was unable to access your personal certificate (email %1).[%END%]
[%|loc(conf.email,domain)%]Please, in order to receive future encrypted messages send a signed message to %1@%2.[%END%]

[% IF conf.wwsympa_url -%]
[%|loc%]Information about this list:[%END%]
[% 'info' | url_abs([list.name]) %]
[% END -%]
43 changes: 39 additions & 4 deletions default/web_tt2/serveradmin.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,45 @@
[% IF subaction == 'vhosts' %]
<h2>[%|loc%]Virtual Robots[%END%]</h2> <br />
[% IF robots %]
[%|loc%]The following virtual robots are running on this server:[%END%]
<ul>
[% FOREACH vr = robots %]<li><a href="[% vr.value.wwsympa_url %]/serveradmin">[% vr.key %]</a> - <i>[%|loc%]Sympa URL:[%END%]</i> <b>[% vr.value.wwsympa_url %]</b> - <i>[%|loc%]Mail domain:[%END%]</i> <b>[% vr.key %]</b> - <i>[%|loc%]Listmaster(s):[%END%]</i> <b>[% FOREACH admin = vr.value.listmaster %][% admin %] [% END %]</b></li>[% END %]
</ul>
<p>
[%|loc%]The following virtual robots are running on this server:[%END%]
</p>
[% FOREACH vr = robots %]
<h4>
[% IF vr.value.wwsympa_url ~%]
<a href="[% vr.value.wwsympa_url %]/serveradmin">
[% vr.value.title || vr.key %]
</a>
[%~ ELSE ~%]
[% vr.value.title || vr.key %]
[%~ END %]
</h4>
<ul>
<li>
<i>[%|loc%]Mail domain:[%END%]</i>
<b>[% vr.key %]</b>
</li>
[% IF vr.value.wwsympa_url ~%]
<li>
<i>[%|loc%]Sympa URL:[%END%]</i>
<b>[% vr.value.wwsympa_url %]</b>
</li>
[%~ END %]
<li>
<i>[%|loc%]Listmaster(s):[%END%]</i>
[% FOREACH admin = vr.value.listmasters ~%]
[% UNLESS loop.first ~%]
[% UNLESS loop.last ~%]
[%|loc%], [%END%]
[%~ ELSE ~%]
[%|loc%], and [%END%]
[%~ END %]
[%~ END ~%]
<b>[% admin %]</b>
[%~ END %]
</li>
</ul>
[% END %]
[% ELSE %]
<p>[%|loc%]No Virtual Robot defined on this server[%END%]</p>
[% END %]
Expand Down
5 changes: 4 additions & 1 deletion src/cgi/wwsympa.fcgi.in
Original file line number Diff line number Diff line change
Expand Up @@ -16989,8 +16989,11 @@ sub get_server_details {
my $r = $_;
( $r => {
(host => $r), # Compat.<6.2.32
( listmasters =>
[Sympa::get_listmasters_email($r)]
),
map { ($_ => Conf::get_robot_conf($r, $_)) }
qw(listmaster wwsympa_url)
qw(listmaster title wwsympa_url)
}
)
} @robots
Expand Down
3 changes: 0 additions & 3 deletions src/lib/Conf.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1971,9 +1971,6 @@ sub _infer_robot_parameter_values {
if not defined $param->{'config_hash'}{'domain'}
and defined $param->{'config_hash'}{'host'};

$param->{'config_hash'}{'wwsympa_url'} ||= sprintf 'http://%s/sympa',
$param->{'config_hash'}{'domain'};

$param->{'config_hash'}{'static_content_url'} ||=
$Conf{'static_content_url'};
$param->{'config_hash'}{'static_content_path'} ||=
Expand Down
4 changes: 2 additions & 2 deletions src/lib/Sympa/Archive.pm
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ sub html_store {
$yyyy,
$mm,
Conf::get_robot_conf($list->{'domain'}, 'arc_path'),
Conf::get_robot_conf($list->{'domain'}, 'wwsympa_url'),
(Conf::get_robot_conf($list->{'domain'}, 'wwsympa_url') || ''),
$tag
),
'-umask' => $Conf::Conf{'umask'}
Expand Down Expand Up @@ -669,7 +669,7 @@ sub html_rebuild {
$yyyy,
$mm,
Conf::get_robot_conf($robot_id, 'arc_path'),
Conf::get_robot_conf($robot_id, 'wwsympa_url'),
(Conf::get_robot_conf($robot_id, 'wwsympa_url') || ''),
$tag
),
'-umask' => $Conf::Conf{'umask'},
Expand Down
3 changes: 2 additions & 1 deletion src/lib/Sympa/ConfDef.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1249,10 +1249,11 @@ our @params = (
# Basic configuration

{ 'name' => 'wwsympa_url',
'sample' => 'http://web.example.org/sympa',
'sample' => 'https://web.example.org/sympa',
'gettext_id' => 'URL prefix of web interface',
'vhost' => '1',
'file' => 'sympa.conf',
'optional' => '1',
'edit' => '1',
'gettext_comment' =>
'This is used to construct URLs of web interface.',
Expand Down
28 changes: 28 additions & 0 deletions src/lib/Sympa/Upgrade.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1831,6 +1831,34 @@ sub upgrade {
}
}

# GH #330: wwsympa_url would be optional. http://domain/sympa is
# assigned to robot.conf for compatibility.
if (lower_version($previous_version, '6.2.33b.2')) {
my @robot_ids = Sympa::List::get_robots();
foreach my $robot_id (@robot_ids) {
next if $robot_id eq $Conf::Conf{'domain'}; # Primary domain

my $config_file =
sprintf '%s/%s/robot.conf', $Conf::Conf{'etc'}, $robot_id;

my $ifh;
next unless open $ifh, '<', $config_file;
my ($parameter) = grep {/\Awwsympa_url\s+\S+/} <$ifh>;
close $ifh;
next if $parameter;

$log->syslog('info', 'Updating wwsympa_url for %s', $robot_id);
my $ofh;
unless (open $ofh, '>>', $config_file) {
$log->syslog('err', 'Cannot write to %s: %m', $config_file);
next;
}
printf $ofh "\n\n# Added by upgrade from %s\n", $previous_version;
printf $ofh "wwsympa_url\thttp://%s/sympa\n", $robot_id;
close $ofh;
}
}

return 1;
}

Expand Down

0 comments on commit c7362de

Please sign in to comment.