Commit 154c03eb authored by sympa-authors's avatar sympa-authors
Browse files

[feature] notify list creation and list copy to listmasters with one_time_ticket

[-bug] Fix notification of copy list



git-svn-id: https://subversion.renater.fr/sympa/trunk@5058 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent ed3ea3f0
......@@ -10,16 +10,19 @@ Subject: [% FILTER qencode %][%|loc(list.name,list.host,email)%]List "%1@%2" cre
[% conf.wwsympa_url %]/info/[% list.name %]
[%|loc%]To activate/delete this mailing list :[%END%]
[% conf.wwsympa_url %]/get_pending_lists
[% conf.wwsympa_url %]/ticket/[%one_time_ticket%]
[% ELSIF type == 'request_list_renaming' -%]
Subject: [% FILTER qencode %][%|loc(list.name)%]List "%1" renaming[%END%][%END%]
[% IF is_a_copy %]
[%|loc(email,list.name,new_listname)%]%1 has copied list "%2" as a new list "%3"[%END%]
[% ELSE %]
[%|loc(email,list.name,new_listname)%]%1 has renamed list "%2" to "%3"[%END%]
[% END %]
[%|loc%]To activate/delete this mailing list :[%END%]
[% conf.wwsympa_url %]/get_pending_lists
[% conf.wwsympa_url %]/ticket/[%one_time_ticket%]
[% ELSIF type == 'no_db' -%]
Subject: [% FILTER qencode %][%|loc%]No DataBase[%END%][%END%]
......
......@@ -3942,9 +3942,16 @@ sub send_notify_to_listmaster {
&tt2::allow_absolute_path();
}
unless (&send_global_file('listmaster_notification', $listmaster, $robot, $param, $options)) {
&do_log('notice',"Unable to send template 'listmaster_notification' to $listmaster");
return undef;
foreach my $email (split (/\,/, $listmaster)) {
if (($operation eq 'request_list_creation')or($operation eq 'request_list_renaming')) {
$param->{'one_time_ticket'} = &Auth::create_one_time_ticket($email,$robot,'get_pending_lists',$param->{'ip'});
}
unless (&send_global_file('listmaster_notification', $email, $robot, $param, $options)) {
&do_log('notice',"Unable to send template 'listmaster_notification' to $listmaster");
return undef;
}
}
}
......@@ -3959,7 +3966,6 @@ sub send_notify_to_listmaster {
&do_log('notice',"Unable to send template 'listmaster_notification' to $listmaster");
return undef;
}
}else {
&do_log('err','List::send_notify_to_listmaster(%s,%s) : error on incoming parameter "$param", it must be a ref on HASH or a ref on ARRAY', $operation, $robot );
return undef;
......
......@@ -7,13 +7,13 @@
[%|loc%]After the list is created, you will be able to adjust it's configuration.[%END%] <br />
<form action="[% path_cgi %]" method="post">
<fieldset>
<select name="list">
[% FOREACH l = get_which_owner %]
<option value="[% l.name %]">[% l.name %]</option>
[% END %]
</select>
<label for="new_listname">[%|loc%]New list name:[%END%]</label> <input id="new_listname" name="new_listname" value="" />
<input type="hidden" name="new_robot" value=[%robot%] />
<input class="MainMenuLinks" type="submit" name="action_copy_list" value="[%|loc%]copy list configuration[%END%]" />
</fieldset>
</form>
......
......@@ -7817,6 +7817,7 @@ Creates a list using a list template
 
if ($param->{'create_action'} =~ /notify/) {
&wwslog('info','notify listmaster');
unless (&List::send_notify_to_listmaster('request_list_creation',$robot,
{'list' => $list,
'email' => $param->{'user'}{'email'}})) {
......@@ -9522,9 +9523,7 @@ sub _restrict_values {
 
sub do_copy_list {
&wwslog('info', 'do_copy_list(%s,%s)', $in{'new_listname'}, $in{'new_robot'});
$in{'new_robot'} = $robot;
&do_rename_list('copy');
}
 
# in order to rename a list you must be list owner and you must be allowed to create new list
......@@ -9567,7 +9566,6 @@ sub do_rename_list {
'error_type' => 'authorization'});
return undef;
}
## Check listname on SMTP server
my $res = list_check_smtp($in{'new_listname'}, $robot);
unless ( defined($res) ) {
......@@ -9605,7 +9603,6 @@ sub do_rename_list {
return 'rename_list_request';
}
}
unless ($mode eq 'copy') {
$list->savestats();
......@@ -9633,9 +9630,9 @@ sub do_rename_list {
&web_db_log({'parameters' => "$in{'new_listname'},$in{'new_robot'}",
'status' => 'error',
'error_type' => 'unknown_robot'});
return undef;
return undef;
}
if ($mode eq 'copy') {
if ($mode eq 'copy') {
unless ( $list = &admin::clone_list_as_empty($in{'list'},$robot,$in{'new_listname'},$in{'new_robot'},$param->{'user'}{'email'})){
&wwslog('info',"do_rename_list : unable to load $in{'new_listname'} while renamming");
&report::reject_report_web('intern','clone_list_as_empty',{'new_listname' => $in{'new_listname'}},$param->{'action'},$list,$param->{'user'}{'email'},$robot);
......@@ -9652,8 +9649,9 @@ sub do_rename_list {
$list->{'admin'}{'status'} = 'pending' ;
&List::send_notify_to_listmaster('request_list_renaming',$robot,
{'list' => $list,
'new_listname' => $in{'new_listname'},
'email' => $param->{'user'}{'email'}});
'new_listname' => $in{'new_listname'},
'email' => $param->{'user'}{'email'},
'is_a_copy' => 'true'});
&report::notice_report_web('pending_list',{},$param->{'action'},$list);
}
......@@ -14861,8 +14859,8 @@ sub do_delete_pictures {
if ($in{'previous_action'} eq 'arcsearch') {
$in{'previous_action'} = 'arc';
}
$in{'list'} = $in{'previous_list'};
return $in{'previous_action'};
$in{'list'} = $in{'previous_list'};
return $in{'previous_action'};
}
 
return 'home';
......
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