fix(admin): replicate reference comment settings page 1:1

- Rewrite post_list/comment schema (PHP + JS) with the reference theme's
  field set, order, defaults and dependencies; smilie, comment location
  and quick-reply fields excluded
- Map PostDisplay::get_comment_display_settings() to the new keys without
  legacy fallback: close_comments, comment_paginate_type (ajax_lists),
  user_edit_comment master switch, WP comment_order for sorting
- Wire comment_box_hide visibility gate (signin / vip / vip_2 / auth)
- Drop dead comment settings (order/per_page/depth/avatar/hot threshold/
  empty text/city), the dead post_close_comments field, and city readers
  now fully owned by the IP-geo extension
- Add comment settings reference contract test
This commit is contained in:
2026-09-24 13:43:51 +08:00
parent 264f2c51b2
commit c331b2aeef
11 changed files with 382 additions and 200 deletions
+4 -5
View File
@@ -40,15 +40,14 @@ if (!function_exists('aksrt_comment_action_permissions')) :
return false;
};
$edit_window = 10;
// 允许用户编辑评论:参考主题 user_edit_comment 总开关(关闭后本人亦不可编辑)。
$user_edit = true;
if (class_exists('\AKSRT\Settings\Settings')) {
$display = \AKSRT\Settings\Settings::get_comment_display_settings();
$edit_window = (int) ($display['edit_window'] ?? 10);
$user_edit = !isset($display['user_edit']) || !empty($display['user_edit']);
}
$within_window = $edit_window > 0
&& (time() - strtotime((string) $comment->comment_date_gmt)) < ($edit_window * MINUTE_IN_SECONDS);
$can_edit_own = $is_owner && $within_window && $can('comment_edit');
$can_edit_own = $is_owner && $user_edit && $can('comment_edit');
$can_edit_others = (!$is_owner) && (
($is_post_author && $can('comment_edit_my_post'))
|| $can('comment_edit_other')