Skip to content

Commit f926d6c

Browse files
authored
Merge pull request #561 from vichan-devel/revert-560-dismiss_report (misclick)
Temporarily Revert "feature: dismiss all reports for a post" (misclick)
2 parents b3c6896 + aee8288 commit f926d6c

File tree

4 files changed

+23
-40
lines changed

4 files changed

+23
-40
lines changed

inc/config.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,8 +1611,6 @@
16111611
$config['mod']['report_dismiss'] = JANITOR;
16121612
// Dismiss all abuse reports by an IP
16131613
$config['mod']['report_dismiss_ip'] = JANITOR;
1614-
// Dismiss all abuse reports for a post
1615-
$config['mod']['report_dismiss_post'] = JANITOR;
16161614
// View list of bans
16171615
$config['mod']['view_banlist'] = MOD;
16181616
// View the username of the mod who made a ban

inc/mod/pages.php

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2377,8 +2377,7 @@ function mod_reports() {
23772377
'config' => $config,
23782378
'mod' => $mod,
23792379
'token' => make_secure_link_token('reports/' . $report['id'] . '/dismiss'),
2380-
'token_all' => make_secure_link_token('reports/' . $report['id'] . '/dismiss&all'),
2381-
'token_post' => make_secure_link_token('reports/'. $report['id'] . '/dismiss&post'),
2380+
'token_all' => make_secure_link_token('reports/' . $report['id'] . '/dismissall')
23822381
));
23832382

23842383
// Bug fix for https://github.com/savetheinternet/Tinyboard/issues/21
@@ -2403,7 +2402,7 @@ function mod_reports() {
24032402
mod_page(sprintf('%s (%d)', _('Report queue'), $count), $config['file_mod_reports'], array('reports' => $body, 'count' => $count));
24042403
}
24052404

2406-
function mod_report_dismiss($id, $action) {
2405+
function mod_report_dismiss($id, $all = false) {
24072406
global $config;
24082407

24092408
$query = prepare("SELECT `post`, `board`, `ip` FROM ``reports`` WHERE `id` = :id");
@@ -2416,35 +2415,27 @@ function mod_report_dismiss($id, $action) {
24162415
} else
24172416
error($config['error']['404']);
24182417

2419-
switch($action){
2420-
case '&post':
2421-
if (!hasPermission($config['mod']['report_dismiss_post'], $board))
2422-
error($config['error']['noaccess']);
2423-
2424-
$query = prepare("DELETE FROM ``reports`` WHERE `post` = :post");
2425-
$query->bindValue(':post', $post);
2426-
modLog("Dismissed all reports for post #{$id}", $board);
2427-
case '&all':
2428-
if (!hasPermission($config['mod']['report_dismiss_ip'], $board))
2429-
error($config['error']['noaccess']);
2430-
2431-
$query = prepare("DELETE FROM ``reports`` WHERE `ip` = :ip");
2432-
$query->bindValue(':ip', $ip);
2433-
$cip = cloak_ip($ip);
2434-
modLog("Dismissed all reports by <a href=\"?/IP/$cip\">$cip</a>");
2435-
break;
2436-
case '':
2437-
default:
2438-
if (!hasPermission($config['mod']['report_dismiss'], $board))
2439-
error($config['error']['noaccess']);
2440-
2441-
$query = prepare("DELETE FROM ``reports`` WHERE `id` = :id");
2442-
$query->bindValue(':id', $id);
2443-
modLog("Dismissed a report for post #{$id}", $board);
2444-
break;
2418+
if (!$all && !hasPermission($config['mod']['report_dismiss'], $board))
2419+
error($config['error']['noaccess']);
2420+
2421+
if ($all && !hasPermission($config['mod']['report_dismiss_ip'], $board))
2422+
error($config['error']['noaccess']);
2423+
2424+
if ($all) {
2425+
$query = prepare("DELETE FROM ``reports`` WHERE `ip` = :ip");
2426+
$query->bindValue(':ip', $ip);
2427+
} else {
2428+
$query = prepare("DELETE FROM ``reports`` WHERE `id` = :id");
2429+
$query->bindValue(':id', $id);
24452430
}
24462431
$query->execute() or error(db_error($query));
24472432

2433+
$cip = cloak_ip($ip);
2434+
if ($all)
2435+
modLog("Dismissed all reports by <a href=\"?/IP/$cip\">$cip</a>");
2436+
else
2437+
modLog("Dismissed a report for post #{$post} <small>(#{$id})</small>", $board);
2438+
24482439
header('Location: ?/reports', true, $config['redirect_http']);
24492440
}
24502441

mod.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
'/rebuild' => 'secure_POST rebuild', // rebuild static files
5757
'/reports' => 'reports', // report queue
58-
'/reports/(\d+)/dismiss(&all|&post)?' => 'secure report_dismiss', // dismiss a report
58+
'/reports/(\d+)/dismiss(all)?' => 'secure report_dismiss', // dismiss a report
5959

6060
'/IP/([\w.:]+)' => 'secure_POST ip', // view ip address
6161
'/IP/([\w.:]+)/remove_note/(\d+)' => 'secure ip_remove_note', // remove note from ip address

templates/mod/report.html

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,9 @@
1717
{% endif %}
1818
{% if mod|hasPermission(config.mod.report_dismiss_ip, report.board) %}
1919
{% if mod|hasPermission(config.mod.report_dismiss, report.board) %}
20-
|&nbsp;
20+
|
2121
{% endif %}
22-
<a title="{% trans 'Discard all abuse reports by this IP address' %}" href="?/reports/{{ report.id }}/dismiss&amp;all/{{ token_all }}">Dismiss+</a>
23-
{% endif %}
24-
{% if mod|hasPermission(config.mod.report_dismiss_post, report.board) %}
25-
{% if mod|hasPermission(config.mod.report_dismiss, report.board) %}
26-
|&nbsp;
27-
{% endif %}
28-
<a title="{% trans 'Dismissed all reports for the post' %}" href="?/reports/{{ report.id }}/dismiss&amp;post/{{ token_post }}">Dismiss Post</a>
22+
<a title="{% trans 'Discard all abuse reports by this IP address' %}" href="?/reports/{{ report.id }}/dismissall/{{ token_all }}">Dismiss+</a>
2923
{% endif %}
3024
{% endif %}
3125
</div>

0 commit comments

Comments
 (0)