Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Sympa
Commits
1524e6fb
Commit
1524e6fb
authored
Feb 15, 2020
by
IKEDA Soji
Browse files
WWSympa: sync_include: Add a button to synchronize owners / moderators in Web interface (#857)
parent
5d19b9ba
Changes
3
Show whitespace changes
Inline
Side-by-side
default/mail_tt2/report.tt2
View file @
1524e6fb
...
...
@@ -408,10 +408,16 @@
[%~ ELSIF report_entry == 'no_msg_document' ~%]
[%|loc(report_param.list)%]No message and no document to moderate for list %1[%END%]
[%~ ELSIF report_entry == '
subscri
ber
s
_updated' ~%]
[%|loc%]The list of list
mem
bers have been built/updated.[%END%]
[%~ ELSIF report_entry == '
mem
ber_updated' ~%]
[%|loc%]The list of list
subscri
bers have been built/updated.[%END%]
[%~ ELSIF report_entry == 'subscribers_updated_soon' ~%]
[%~ ELSIF report_entry == 'owner_updated' ~%]
[%|loc%]The list of list owners have been built/updated.[%END%]
[%~ ELSIF report_entry == 'editor_updated' ~%]
[%|loc%]The list of list moderators have been built/updated.[%END%]
[%~ ELSIF report_entry == 'subscribers_updated_soon' # No longer used ~%]
[%|loc%]The list of list members will be built/updated soon (a few minutes).[%END%]
[%~ ELSIF report_entry == 'subscribers_noticed_deleted_topics' ~%]
...
...
default/web_tt2/review.tt2
View file @
1524e6fb
...
...
@@ -55,12 +55,13 @@
</a>
<br />
[% IF may_
sync
%]
[% IF may_
include.member
%]
<br />
<form name="synchronize_list_members" action="[% path_cgi %]" method="post">
<input class="MainMenuLinks heavyWork" type="submit" name="action_sync_include"
value="[%|loc%]Synchronize members with data sources[%END%]" />
<input type="hidden" name="list" value="[% list %]"/>
<input type="hidden" name="role" value="member"/>
</form>
[% END %]
<hr>
...
...
@@ -456,6 +457,21 @@
</fieldset>
</form>
[% IF may_include.$role ~%]
<br />
<form name="sync_include" action="[% path_cgi %]" method="post">
<input class="MainMenuLinks heavyWork" type="submit"
name="action_sync_include"
value="[% IF role == 'owner' ~%]
[%|loc%]Synchronize owners with data sources[%END%]
[%~ ELSE ~%]
[%|loc%]Synchronize moderators with data sources[%END%]
[%~ END %]" />
<input type="hidden" name="list" value="[% list %]"/>
<input type="hidden" name="role" value="[% role %]"/>
</form>
[%~ END %]
[%# AJAX modal dialog ~%]
<div id="edit" class="reveal medium" data-reveal role="dialog"
aria-labelledby="[%|loc%]View user[%END%]" aria-hidden="true">
...
...
src/cgi/wwsympa.fcgi.in
View file @
1524e6fb
...
...
@@ -2859,10 +2859,21 @@ sub check_param_out {
$param->{'may_post_reason'} = $reason;
}
if ( $list->has_include_data_sources()
&& $param->{'is_owner'}) {
$param->{'may_sync'} = 1;
}
$param->{'may_include'} = {
member => (
$param->{'is_owner'} and $list->has_data_sources('member')
),
owner => (
$param->{'is_privileged_owner'}
and $list->has_data_sources('owner')
),
editor => (
$param->{'is_privileged_owner'}
and $list->has_data_sources('editor')
),
};
# Compat.<=6.2.54
$param->{'may_sync'} = $param->{'may_include'}{'member'};
}
## Should Not be used anymore ##
...
...
@@ -4806,19 +4817,15 @@ sub _review_member {
my @additional_fields = split ',',
$Conf::Conf{'db_additional_subscriber_fields'};
## Members list synchronization if list has included data sources.
if ($list->has_include_data_sources()) {
# Members list synchronization if list has included data sources.
my $sync_result = $list->on_the_fly_sync_include(use_ttl => 1);
unless (defined $sync_result) {
Sympa::WWW::Report::reject_report_web('intern',
'sync_include_failed',
{}, $param->{'action'}, $list, $param->{'user'}{'email'},
$robot);
Sympa::WWW::Report::reject_report_web('intern', 'sync_include_failed',
{}, $param->{'action'}, $list, $param->{'user'}{'email'}, $robot);
} elsif ($sync_result) {
Sympa::WWW::Report::notice_report_web('
subscri
ber
s
_updated', {},
Sympa::WWW::Report::notice_report_web('
mem
ber_updated', {},
$param->{'action'});
}
}
# Members list
# Some review pages may be empty while viewed by subscribers.
...
...
@@ -10620,20 +10627,22 @@ sub do_edit_list {
## If list has included data sources, update them and delete sync_include
## task.
if ($data_source_updated) {
if ($list->on_the_fly_sync_include('use_ttl' => 0)) {
Sympa::WWW::Report::notice_report_web('subscribers_updated', {},
$param->{'action'});
} else {
my $sync_result = $list->on_the_fly_sync_include(use_ttl => 0);
unless (defined $sync_result) {
Sympa::WWW::Report::reject_report_web('intern',
'sync_include_failed',
{}, $param->{'action'}, $list, $param->{'user'}{'email'},
$robot);
} elsif ($sync_result) {
Sympa::WWW::Report::notice_report_web('member_updated', {},
$param->{'action'});
}
}
# Call sync_include
_admin
if there are changes about owners or editors.
# Call sync_include
()
if there are changes about owners or editors.
#FIXME:Update only when owner or editor was updated.
unless (defined $list->sync_include_admin) {
unless (defined $list->sync_include('owner')
and defined $list->sync_include('editor')) {
Sympa::WWW::Report::reject_report_web('intern',
'sync_include_admin_failed', {}, $param->{'action'}, $list,
$param->{'user'}{'email'}, $robot);
...
...
@@ -16512,16 +16521,30 @@ sub do_wsdl {
## Synchronize list members with data sources
sub do_sync_include {
wwslog('info', '(%s)', $in{'list'});
wwslog('info', '(%s, %s)', $in{'list'}, $in{'role'});
my $role = $in{'role'} || 'member'; # Compat.<=6.2.52.
$in{'page'} = $role unless $role eq 'member';
$param->{'list'} = $list->{'name'};
$param->{'role'} = $role;
$param->{'page'} = $role unless $role eq 'member';
unless ($list->sync_include()) {
unless (
defined
$list->sync_include(
$role
)) {
Sympa::WWW::Report::reject_report_web('intern',
'sync_include_failed', {},
$param->{'action'}, $list, $param->{'user'}{'email'}, $robot);
return undef;
}
Sympa::WWW::Report::notice_report_web('subscribers_updated', {},
$param->{'action'});
Sympa::WWW::Report::notice_report_web(
{ member => 'member_updated',
owner => 'owner_updated',
editor => 'editor_updated',
}->{$role},
{},
$param->{'action'}
);
return 'review';
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment