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:
kate522 committed 2026-09-24 13:43:51 +08:00
1 parent 264f2c51b2
commit c331b2aeef
11 files changed
+382 -200

No files matched your search

+22 -11
View File
@@ -23,6 +23,26 @@ if (!function_exists('aksrt_get_user_identity_signals')) {
}
}
if (!function_exists('aksrt_current_user_is_verified')) {
/**
* Whether the current user carries a verification (认证) signal.
*
* @return bool
*/
function aksrt_current_user_is_verified(): bool {
$user_id = get_current_user_id();
if ($user_id <= 0 || !function_exists('aksrt_get_user_identity_signals')) {
return false;
}
foreach (aksrt_get_user_identity_signals($user_id) as $signal) {
if ((string) ($signal['type'] ?? '') === 'verify') {
return true;
}
}
return false;
}
}
if (!function_exists('aksrt_render_user_identity_chips')) {
/**
* Render compact identity chips (verify / level / badges).
@@ -537,7 +557,8 @@ if (!function_exists('aksrt_get_worn_medal_icon')) {
if (!function_exists('aksrt_is_blog_comment_hot')) {
/**
* "神评" for ordinary post comments when likes cross threshold.
* "神评" for ordinary post comments when likes cross the fixed threshold
* (参考主题固定 10 赞,主题不再提供该阈值配置).
*/
function aksrt_is_blog_comment_hot($comment): bool {
$comment_id = $comment instanceof WP_Comment ? (int) $comment->comment_ID : (int) $comment;
@@ -548,16 +569,6 @@ if (!function_exists('aksrt_is_blog_comment_hot')) {
return true;
}
$threshold = 10;
if (class_exists('\AKSRT\Settings\Settings') && method_exists('\AKSRT\Settings\Settings', 'get_comment_display_settings')) {
$display = \AKSRT\Settings\Settings::get_comment_display_settings();
if (isset($display['hot_threshold'])) {
$threshold = max(1, (int) $display['hot_threshold']);
}
}
$all = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_all() : [];
if (isset($all['comment_hot_threshold'])) {
$threshold = max(1, (int) $all['comment_hot_threshold']);
}
$likes = function_exists('aksrt_get_comment_likes') ? aksrt_get_comment_likes($comment_id) : (int) get_comment_meta($comment_id, 'aksrt_comment_likes', true);
if ($likes < $threshold) {
return false;