fix(report): align the report modal with the reference theme 1:1

- read preset reasons from the real source (ban_preset_reason via
  UserRuntime::ban_settings); the previous injection read a
  nonexistent report.categories key, so backend reasons never showed
- rebuild the modal on the reference markup contract: edit-header
  warning header, reason chips toggling the reference .active class
  (focus color), other-reason textarea, violation link, description,
  but-average modal-buts footer
- add image evidence upload gated by user_report_img_s: new
  /report/upload-image route reusing the comment upload handler with
  its own permission, preview/remove UI, up to 3 images appended to
  the report content
- render the backend report notice (user_report_desc, sanitized HTML)
  inside the modal
- widen the dialog to the reference 600px desktop geometry and share
  the form-upload preview styles with the order review modal
- extend the report contract test accordingly
This commit is contained in:
2026-09-20 14:20:09 +08:00
parent 913958820c
commit 7a80297a56
7 changed files with 329 additions and 91 deletions
+15 -4
View File
@@ -487,13 +487,24 @@ trait ScriptsPart1c {
'restUrl' => esc_url_raw(rest_url('aksrt/v1')),
// Alias used by modal-auth / follow / report (same value as restUrl).
'apiUrl' => esc_url_raw(rest_url('aksrt/v1')),
// 举报弹窗预置原因(report.js 徽章选择数据源)。
// 举报弹窗数据(report.js):预置原因读取后台“禁封/举报”的 ban_preset_reason
// (UserRuntime::ban_settings,参考主题 _pz('ban_preset_reason') 同源),
// 图片举证开关与举报说明读取 user_report_img_s / user_report_desc。
'reportCategories' => (function () {
if (!class_exists('\AKSRT\Settings\Settings')) {
if (!class_exists('\AKSRT\Settings\UserRuntime')) {
return [];
}
$report = \AKSRT\Settings\Settings::get_user_identity_settings()['report'] ?? [];
return is_array($report['categories'] ?? null) ? array_values($report['categories']) : [];
return \AKSRT\Settings\UserRuntime::ban_settings()['reasons'] ?? [];
})(),
'report' => (function () {
if (!class_exists('\AKSRT\Settings\UserRuntime')) {
return ['imgEnabled' => false, 'desc' => ''];
}
$report = \AKSRT\Settings\UserRuntime::report_settings();
return [
'imgEnabled' => !empty($report['img_enabled']),
'desc' => (string) ($report['desc'] ?? ''),
];
})(),
'stickyEnabled' => class_exists('\AKSRT\Settings\Settings') ? !empty(\AKSRT\Settings\Settings::get_post_list_style_settings()['sticky_s']) : true,
'stickyPages' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_post_list_style_settings()['sticky_s'] : ['home', 'cat'],