forked from leftypol/leftypol
pages.php: mod_reports signal if there are more reports than the limit
This commit is contained in:
parent
e7518dfe25
commit
c94a7cb403
1 changed files with 22 additions and 6 deletions
|
@ -2917,10 +2917,11 @@ function mod_reports() {
|
|||
}
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
$body = '';
|
||||
$to_build = [];
|
||||
foreach ($reports as $report) {
|
||||
if (!isset($report_posts[$report['board']][$report['post']])) {
|
||||
if (isset($report_posts[$report['board']][$report['post']])) {
|
||||
$to_build[] = $report;
|
||||
} else {
|
||||
// Invalid report (post has since been deleted)
|
||||
if ($config['auto_maintenance'] != false) {
|
||||
$query = prepare("DELETE FROM ``reports`` WHERE `post` = :id AND `board` = :board");
|
||||
|
@ -2930,7 +2931,17 @@ function mod_reports() {
|
|||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (\count($to_build) > $reports_limit) {
|
||||
\array_pop($to_build);
|
||||
$has_extra = true;
|
||||
} else {
|
||||
$has_extra = false;
|
||||
}
|
||||
|
||||
$body = '';
|
||||
foreach ($to_build as $report) {
|
||||
openBoard($report['board']);
|
||||
|
||||
$post = &$report_posts[$report['board']][$report['post']];
|
||||
|
@ -2967,11 +2978,16 @@ function mod_reports() {
|
|||
if (isset($__old_body_truncate_char)) {
|
||||
$config['body_truncate_char'] = $__old_body_truncate_char;
|
||||
}
|
||||
|
||||
$count++;
|
||||
}
|
||||
|
||||
mod_page(\sprintf('%s (%d)', _('Report queue'), $count), 'mod/reports.html', [ 'reports' => $body, 'count' => $count ]);
|
||||
$count = \count($to_build);
|
||||
$header_count = $has_extra ? "{$count}+" : (string)$count;
|
||||
|
||||
mod_page(
|
||||
\sprintf('%s (%s)', _('Report queue'), $header_count),
|
||||
'mod/reports.html',
|
||||
[ 'reports' => $body, 'count' => $count ]
|
||||
);
|
||||
}
|
||||
|
||||
function mod_report_dismiss($id, $all = false) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue