1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-28 01:10:51 +01:00

Merge pull request #561 from vichan-devel/revert-560-dismiss_report (misclick)

Temporarily Revert "feature: dismiss all reports for a post" (misclick)
This commit is contained in:
RealAngeleno 2023-04-23 19:04:32 -07:00 committed by GitHub
commit f926d6c399
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 40 deletions

View File

@ -1611,8 +1611,6 @@
$config['mod']['report_dismiss'] = JANITOR; $config['mod']['report_dismiss'] = JANITOR;
// Dismiss all abuse reports by an IP // Dismiss all abuse reports by an IP
$config['mod']['report_dismiss_ip'] = JANITOR; $config['mod']['report_dismiss_ip'] = JANITOR;
// Dismiss all abuse reports for a post
$config['mod']['report_dismiss_post'] = JANITOR;
// View list of bans // View list of bans
$config['mod']['view_banlist'] = MOD; $config['mod']['view_banlist'] = MOD;
// View the username of the mod who made a ban // View the username of the mod who made a ban

View File

@ -2377,8 +2377,7 @@ function mod_reports() {
'config' => $config, 'config' => $config,
'mod' => $mod, 'mod' => $mod,
'token' => make_secure_link_token('reports/' . $report['id'] . '/dismiss'), 'token' => make_secure_link_token('reports/' . $report['id'] . '/dismiss'),
'token_all' => make_secure_link_token('reports/' . $report['id'] . '/dismiss&all'), 'token_all' => make_secure_link_token('reports/' . $report['id'] . '/dismissall')
'token_post' => make_secure_link_token('reports/'. $report['id'] . '/dismiss&post'),
)); ));
// Bug fix for https://github.com/savetheinternet/Tinyboard/issues/21 // Bug fix for https://github.com/savetheinternet/Tinyboard/issues/21
@ -2403,7 +2402,7 @@ function mod_reports() {
mod_page(sprintf('%s (%d)', _('Report queue'), $count), $config['file_mod_reports'], array('reports' => $body, 'count' => $count)); mod_page(sprintf('%s (%d)', _('Report queue'), $count), $config['file_mod_reports'], array('reports' => $body, 'count' => $count));
} }
function mod_report_dismiss($id, $action) { function mod_report_dismiss($id, $all = false) {
global $config; global $config;
$query = prepare("SELECT `post`, `board`, `ip` FROM ``reports`` WHERE `id` = :id"); $query = prepare("SELECT `post`, `board`, `ip` FROM ``reports`` WHERE `id` = :id");
@ -2416,35 +2415,27 @@ function mod_report_dismiss($id, $action) {
} else } else
error($config['error']['404']); error($config['error']['404']);
switch($action){ if (!$all && !hasPermission($config['mod']['report_dismiss'], $board))
case '&post':
if (!hasPermission($config['mod']['report_dismiss_post'], $board))
error($config['error']['noaccess']); error($config['error']['noaccess']);
$query = prepare("DELETE FROM ``reports`` WHERE `post` = :post"); if ($all && !hasPermission($config['mod']['report_dismiss_ip'], $board))
$query->bindValue(':post', $post);
modLog("Dismissed all reports for post #{$id}", $board);
case '&all':
if (!hasPermission($config['mod']['report_dismiss_ip'], $board))
error($config['error']['noaccess']); error($config['error']['noaccess']);
if ($all) {
$query = prepare("DELETE FROM ``reports`` WHERE `ip` = :ip"); $query = prepare("DELETE FROM ``reports`` WHERE `ip` = :ip");
$query->bindValue(':ip', $ip); $query->bindValue(':ip', $ip);
$cip = cloak_ip($ip); } else {
modLog("Dismissed all reports by <a href=\"?/IP/$cip\">$cip</a>");
break;
case '':
default:
if (!hasPermission($config['mod']['report_dismiss'], $board))
error($config['error']['noaccess']);
$query = prepare("DELETE FROM ``reports`` WHERE `id` = :id"); $query = prepare("DELETE FROM ``reports`` WHERE `id` = :id");
$query->bindValue(':id', $id); $query->bindValue(':id', $id);
modLog("Dismissed a report for post #{$id}", $board);
break;
} }
$query->execute() or error(db_error($query)); $query->execute() or error(db_error($query));
$cip = cloak_ip($ip);
if ($all)
modLog("Dismissed all reports by <a href=\"?/IP/$cip\">$cip</a>");
else
modLog("Dismissed a report for post #{$post} <small>(#{$id})</small>", $board);
header('Location: ?/reports', true, $config['redirect_http']); header('Location: ?/reports', true, $config['redirect_http']);
} }

View File

@ -55,7 +55,7 @@ $pages = array(
'/rebuild' => 'secure_POST rebuild', // rebuild static files '/rebuild' => 'secure_POST rebuild', // rebuild static files
'/reports' => 'reports', // report queue '/reports' => 'reports', // report queue
'/reports/(\d+)/dismiss(&all|&post)?' => 'secure report_dismiss', // dismiss a report '/reports/(\d+)/dismiss(all)?' => 'secure report_dismiss', // dismiss a report
'/IP/([\w.:]+)' => 'secure_POST ip', // view ip address '/IP/([\w.:]+)' => 'secure_POST ip', // view ip address
'/IP/([\w.:]+)/remove_note/(\d+)' => 'secure ip_remove_note', // remove note from ip address '/IP/([\w.:]+)/remove_note/(\d+)' => 'secure ip_remove_note', // remove note from ip address

View File

@ -17,15 +17,9 @@
{% endif %} {% endif %}
{% if mod|hasPermission(config.mod.report_dismiss_ip, report.board) %} {% if mod|hasPermission(config.mod.report_dismiss_ip, report.board) %}
{% if mod|hasPermission(config.mod.report_dismiss, report.board) %} {% if mod|hasPermission(config.mod.report_dismiss, report.board) %}
|&nbsp; |
{% endif %} {% endif %}
<a title="{% trans 'Discard all abuse reports by this IP address' %}" href="?/reports/{{ report.id }}/dismiss&amp;all/{{ token_all }}">Dismiss+</a> <a title="{% trans 'Discard all abuse reports by this IP address' %}" href="?/reports/{{ report.id }}/dismissall/{{ token_all }}">Dismiss+</a>
{% endif %}
{% if mod|hasPermission(config.mod.report_dismiss_post, report.board) %}
{% if mod|hasPermission(config.mod.report_dismiss, report.board) %}
|&nbsp;
{% endif %}
<a title="{% trans 'Dismissed all reports for the post' %}" href="?/reports/{{ report.id }}/dismiss&amp;post/{{ token_post }}">Dismiss Post</a>
{% endif %} {% endif %}
{% endif %} {% endif %}
</div> </div>