fix(report): unify the frontend report entry and modal
- enqueue report.js on singular pages too: the single meta box and comment report buttons rendered without their script handler, so clicking the report item did nothing - align the report runtime default with the admin schema and the reference theme (user_report_s default true) so the public user home cover menu shows the report entry - rebuild report.js on top of AksrtModalRuntime following the reference theme modal format: red warning header, preset reason badges with an other-reason textarea, violation link field, detail description and a cancel/submit footer; submit goes through the unified /report/submit endpoint - keep report inside the comment three-dot dropdown and enrich the payload (target name/avatar) for the modal; inject configured report categories via aksrtData.reportCategories - update the report contract test accordingly
This commit is contained in:
@@ -173,7 +173,8 @@ class UserRuntime {
|
||||
}, $medal['items_by_slug'])),
|
||||
],
|
||||
'report' => [
|
||||
'enabled' => (bool) ($settings['user_report_s'] ?? $settings['user_report_enabled'] ?? false),
|
||||
// 默认开启:对齐后台 schema default true 与参考主题 _pz('user_report_s', true)。
|
||||
'enabled' => (bool) ($settings['user_report_s'] ?? $settings['user_report_enabled'] ?? true),
|
||||
'public_entry' => !isset($settings['user_report_public_entry']) || !empty($settings['user_report_public_entry']),
|
||||
'public_notice' => !isset($settings['user_report_public_notice']) || !empty($settings['user_report_public_notice']),
|
||||
'ban_notice_text' => $ban_notice_text !== '' ? $ban_notice_text : __('当前账号处于限制状态,部分互动能力已关闭。', 'aksrt'),
|
||||
@@ -252,7 +253,8 @@ class UserRuntime {
|
||||
public static function report_settings(): array {
|
||||
$settings = Settings::get_all();
|
||||
return [
|
||||
'enabled' => (bool) ($settings['user_report_s'] ?? $settings['user_report_enabled'] ?? false),
|
||||
// 默认开启:对齐后台 schema default true 与参考主题 _pz('user_report_s', true)。
|
||||
'enabled' => (bool) ($settings['user_report_s'] ?? $settings['user_report_enabled'] ?? true),
|
||||
'public_entry' => !isset($settings['user_report_public_entry']) || !empty($settings['user_report_public_entry']),
|
||||
'public_notice' => !isset($settings['user_report_public_notice']) || !empty($settings['user_report_public_notice']),
|
||||
'ban_notice_text' => sanitize_text_field((string) ($settings['user_report_ban_notice_text'] ?? '')),
|
||||
|
||||
Reference in New Issue
Block a user