feat(admin): rebuild ban page to mirror the reference theme

- rename the users.php submenu to 举报&禁封申诉 and the page heading to
  用户禁封申诉及用户举报管理
- merge report tickets and ban appeals into one Zibll-style queue:
  type filter buttons (全部/禁封申诉/用户举报), status subsubsub
  (全部/待处理/已批准/已拒绝), search box, sortable widefat table with
  the same column set (状态/类型/提交用户/详情/提交时间/更新时间),
  inline process forms and 20-per-page pagination
- report process form shows the reported target, restriction status and
  an enforcement action select; appeal form offers approve/reject radios
  with a message to the user
- move restriction enforcement into ReportCenter::apply_action so REST
  and the native page share one implementation; add get_report_row()
- drop the old three-tab rendering (reports/appeals tabs) and fix all
  notice/mail/SPA links to the merged page
This commit is contained in:
2026-09-19 22:00:17 +08:00
parent 3764d48755
commit 902e71ee62
8 changed files with 626 additions and 217 deletions
+2 -53
View File
@@ -354,61 +354,10 @@ trait UserControllerReportOperations {
}
private function apply_report_action(string $target_type, int $target_id, string $action_taken, string $reason = ''): string {
if ($target_id <= 0 || $action_taken === 'none') {
if (!class_exists('\AKSRT\Messages\ReportCenter')) {
return '';
}
if ($target_type === 'user') {
if (!class_exists('\AKSRT\User\Restriction')) {
return '';
}
$svc = \AKSRT\User\Restriction::get_instance();
if ($action_taken === 'clear') {
$removed = $svc->lift_user_restriction($target_id);
return $removed > 0
? sprintf(__('已解除 %d 条生效中的限制', 'aksrt'), $removed)
: __('该用户没有生效中的限制', 'aksrt');
}
if (in_array($action_taken, \AKSRT\User\Restriction::TYPES, true)) {
$labels = [
\AKSRT\User\Restriction::TYPE_WARN => __('警告', 'aksrt'),
\AKSRT\User\Restriction::TYPE_MUTE => __('禁言', 'aksrt'),
\AKSRT\User\Restriction::TYPE_SUSPEND => __('停权', 'aksrt'),
\AKSRT\User\Restriction::TYPE_BAN => __('封禁', 'aksrt'),
];
$result = $svc->restrict(
$target_id,
$action_taken,
$reason !== '' ? $reason : __('举报处理处罚', 'aksrt'),
\AKSRT\User\Restriction::SCOPE_GLOBAL,
'',
get_current_user_id()
);
if (!empty($result['success'])) {
return sprintf(__('已对用户执行限制:%s', 'aksrt'), $labels[$action_taken] ?? $action_taken);
}
return '';
}
return '';
}
if ($action_taken === 'content_removed' && $target_type === 'post' && get_post($target_id)) {
wp_update_post([
'ID' => $target_id,
'post_status' => 'pending',
]);
return __('已将内容改为待审状态', 'aksrt');
}
if ($action_taken === 'content_removed' && $target_type === 'comment' && get_comment($target_id)) {
wp_set_comment_status($target_id, 'hold', true);
return __('已将评论改为待审状态', 'aksrt');
}
return '';
return \AKSRT\Messages\ReportCenter::get_instance()->apply_action($target_type, $target_id, $action_taken, $reason);
}
private function get_report_status_options(): array {