Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
sympa
sympa
Commits
00655023
Unverified
Commit
00655023
authored
Jun 26, 2019
by
IKEDA Soji
Committed by
GitHub
Jun 26, 2019
Browse files
Merge pull request #640 from ldidry/fix-634 by ldidry
Add « report as spam » option when deleting archives
parents
d33863d6
4975105e
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
default/mhonarc-ressources.tt2
View file @
00655023
This diff is collapsed.
Click to expand it.
default/web_tt2/confirm_action.tt2
View file @
00655023
...
...
@@ -478,6 +478,13 @@
[% FOREACH m = msgid ~%]
<input type="hidden" name="msgid" value="[% m %]" />
[%~ END %]
[% IF is_listmaster || is_owner %]
<input type="checkbox" name="signal_as_spam"
[% IF signal_as_spam %]checked[% END %] />
<label for="signal_as_spam">
[%|loc%]Report messages as undetected spam[%END%]
</label>
[%~ END %]
[%~ ELSIF confirm_action == 'remove_template' ~%]
<input type="hidden" name="webormail" value="[% webormail %]" />
<input type="hidden" name="scope" value="[% scope %]" />
...
...
src/cgi/wwsympa.fcgi.in
View file @
00655023
...
...
@@ -8942,14 +8942,18 @@ sub do_remove_arc {
$param->{'status'} = 'no_msgid';
return undef;
}
$param->{'yyyy'} = $in{'yyyy'};
$param->{'month'} = $in{'month'};
$param->{'msgid'} = [@msgids];
$param->{'yyyy'} = $in{'yyyy'};
$param->{'month'} = $in{'month'};
$param->{'signal_as_spam'} = $in{'signal_as_spam'};
$param->{'msgid'} = [@msgids];
# Action confirmed?
my $next_action = $session->confirm_action(
$in{'action'}, $in{'response_action'},
arg => join(',', $in{'yyyy'}, $in{'month'}, @msgids),
$in{'action'},
$in{'response_action'},
arg => join(
',', $in{'yyyy'}, $in{'month'}, $in{signal_as_spam}, @msgids
),
previous_action => 'arc'
);
unless ($next_action eq '1') {
...
...
@@ -8962,6 +8966,12 @@ sub do_remove_arc {
my $tracking = Sympa::Tracking->new(context => $list);
foreach my $msgid (@msgids) {
chomp $msgid;
if (defined($in{signal_as_spam})
&& $Conf::Conf{'reporting_spam_script_path'} ne '') {
$msg_string .= sprintf "signal_spam %s %s-%s %s\n",
$list->{'name'},
$in{'yyyy'}, $in{'month'}, $msgid;
}
$msg_string .= sprintf "remove_arc %s %s-%s %s\n", $list->{'name'},
$in{'yyyy'}, $in{'month'}, $msgid;
...
...
src/lib/Sympa/Spindle/ProcessArchive.pm
View file @
00655023
...
...
@@ -179,6 +179,22 @@ sub _do_command {
}
_do_remove_arc
(
$context
,
$arc
,
$msgid
,
$message
->
{
sender
});
}
elsif
(
$order
eq
'
signal_spam
')
{
my
(
$arc
,
$msgid
)
=
split
/\s+/
,
$args
,
2
;
unless
(
ref
$context
eq
'
Sympa::List
')
{
$log
->
syslog
('
err
',
'
Unknown list %s
',
$listname
);
next
;
}
unless
(
$arc
=~
/\A\d{4}-\d{2}\z/
)
{
$log
->
syslog
('
err
',
'
Illegal archive path "%s"
',
$arc
);
next
;
}
unless
(
$msgid
and
$msgid
!~
/NO-ID-FOUND\.mhonarc\.org/
)
{
$log
->
syslog
('
err
',
'
No message id found
');
next
;
}
_do_signal_as_spam
(
$context
,
$arc
,
$msgid
,
$message
->
{
sender
});
}
elsif
(
$order
eq
'
rebuildarc
')
{
my
$arc
=
(
defined
$args
and
length
$args
)
?
$args
:
'
*
';
unless
(
$arc
=~
/\A\d{4}-\d{2}\z/
or
$arc
eq
'
*
')
{
...
...
@@ -268,6 +284,93 @@ sub _do_remove_arc {
return
1
;
}
sub
_do_signal_as_spam
{
$log
->
syslog
('
debug2
',
'
(%s, %s, %s, %s)
',
@
_
);
my
$list
=
shift
;
my
$arc
=
shift
;
my
$msgid
=
shift
;
my
$sender
=
shift
;
my
$archive
=
Sympa::
Archive
->
new
(
context
=>
$list
);
unless
(
$archive
->
select_archive
(
$arc
))
{
$log
->
syslog
('
err
',
'
No archive %s of %s
',
$arc
,
$archive
);
return
undef
;
}
my
(
$arc_message
,
$arc_handle
)
=
$archive
->
fetch
(
message_id
=>
$msgid
);
unless
(
$arc_message
)
{
$log
->
syslog
('
err
',
'
Unable to load message with message ID %s found in %s of %s
',
$msgid
,
$arc
,
$archive
);
return
undef
;
}
# If not list owner nor listmaster, check if
# sender of remove order is sender of the message to be
# removed.
unless
(
$list
->
is_admin
('
owner
',
$sender
)
or
Sympa::
is_listmaster
(
$list
,
$sender
))
{
unless
(
lc
$sender
eq
lc
(
$arc_message
->
{
sender
}
||
''))
{
$log
->
syslog
('
err
',
'
Signal as spam command for %s by unauthorized sender: %s
',
$arc_message
,
$sender
);
return
undef
;
}
}
# At this point, requested command is from an authorized person
# (message sender or list admin or listmaster).
$log
->
syslog
('
notice
',
'
Signaling %s in %s of archive %s as spam
',
$msgid
,
$arc
,
$archive
);
if
(
$
Conf::
Conf
{'
reporting_spam_script_path
'}
ne
'')
{
if
(
-
x
$
Conf::
Conf
{'
reporting_spam_script_path
'})
{
my
$script
;
unless
(
open
(
$script
,
"
|
$Conf
::Conf{'reporting_spam_script_path'}
"))
{
$log
->
syslog
('
err
',
"
could not execute
$Conf
::Conf{'reporting_spam_script_path'}
"
);
return
undef
;
}
# Sending encrypted form in case a crypted message would be
# sent by error.
print
$script
$arc_message
->
as_string
;
if
(
close
(
$script
))
{
$log
->
syslog
('
info
',
"
message
$msgid
reported as spam by
$sender
");
}
else
{
$log
->
syslog
('
err
',
"
could not report message
$msgid
as spam (close failed)
");
return
undef
;
}
}
else
{
$log
->
syslog
('
err
',
"
ignoring parameter reporting_spam_script_path, value
$Conf
::Conf{'reporting_spam_script_path'} because not an executable script
"
);
return
undef
;
}
}
$log
->
db_log
(
'
robot
'
=>
$list
->
{'
domain
'},
'
list
'
=>
$list
->
{'
name
'},
'
action
'
=>
'
signal_spam
',
'
parameters
'
=>
$msgid
,
'
msg_id
'
=>
$msgid
,
'
status
'
=>
'
success
',
'
user_email
'
=>
$sender
);
$log
->
add_stat
(
'
robot
'
=>
$list
->
{'
domain
'},
'
list
'
=>
$list
->
{'
name
'},
'
operation
'
=>
'
signal_spam
',
'
mail
'
=>
$sender
);
return
1
;
}
# Old name: do_rebuildarc() in archived.pl.
sub
_do_rebuildarc
{
$log
->
syslog
('
debug2
',
'
(%s, %s)
',
@
_
);
...
...
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