feat(ban): mirror reference theme ban/restriction prompt surface

修复公开主页禁封提示框为空的问题,并对齐参考主题(Zibll)全部前台禁封提示入口:
- fix(profile): 资料卡下方治理提示框渲染为空——模板读取的 tone/message 键与
  数据层实际输出的 state/label/text 契约不匹配;现按禁封类型展示
  「违规已封号/小黑屋禁封中/禁言中」+ 可配置说明文案
- feat(ban): 用户中心页头展示治理状态徽章 + 查看详情入口,直达禁封申诉页
  (参考主题 user_page_header_desc / zib_get_user_ban_info_link)
- feat(ban): 评论拒绝态区分禁封/小黑屋/禁言,附状态徽章与申诉链接
  (参考主题 zib_get_user_ban_nocan_info,原为笼统的无权限文案)
- feat(ban): 禁封申诉页补全状态信息卡(状态/开始时间/结束时间/原因/说明/
  申诉权限),对齐 zib_get_ban_info_modal;此前仅有「禁封原因」一行且无入口
- feat(ban): 昵称旁禁封徽章 + 头像禁封角标(覆盖 VIP 位,参考主题
  user_name_badge / user_avatar_badge 钩子语义),main.css 与入队的
  main.min.css 同步新增角标样式
- fix(ban): 举报入口对已封禁/小黑屋目标隐藏(评论、文章下拉、封面菜单三处,
  对齐 zib_get_report_link 排除语义;禁言为轻量限制不隐藏)
- refactor(ban): 治理展示态收敛为单一数据源 Restriction::get_display_state()
  + state_labels(),资料卡/用户中心/评论拒绝态/昵称徽章共用
- feat(ban): 小黑屋用户开放申诉(对齐参考主题 zib_user_is_ban 双类型语义),
  禁封站内信附加申诉页链接
- test: report-ban 契约测试 +3(展示态单一数据源、提示面入口矩阵、举报排除),
  45 个测试文件全部通过
This commit is contained in:
2026-09-22 13:28:52 +08:00
parent 8d9cca2fe5
commit 7f520803ff
17 changed files with 457 additions and 46 deletions
+21 -4
View File
@@ -66,7 +66,9 @@ $unread_count = $is_own ? aksrt_get_user_unread_notification_count($user_id) : 0
$cover_ban_html = function_exists('aksrt_get_user_cover_menu_action_html')
? aksrt_get_user_cover_menu_action_html($user_id)
: '';
$show_cover_report = $cover_ban_html === '' && $show_report && !$is_own;
// 已封禁/小黑屋用户不展示举报入口(参考主题 zib_get_report_link 排除语义)。
$target_ban_restricted = function_exists('aksrt_is_user_ban_restricted') && aksrt_is_user_ban_restricted($user_id);
$show_cover_report = $cover_ban_html === '' && $show_report && !$is_own && !$target_ban_restricted;
$show_cover_menu = $has_more_details || $show_cover_report || $cover_ban_html !== '';
?><div class="aksrt-author-hero<?php echo $show_cover ? '' : ' aksrt-author-hero--no-cover'; ?>">
<?php if ($show_cover) : ?>
@@ -154,9 +156,24 @@ $show_cover_menu = $has_more_details || $show_cover_report || $cover_ban_html !=
<?php endif; ?>
<?php if (!empty($notice) && is_array($notice)) : ?>
<div class="aksrt-author-hero__notice aksrt-author-hero__notice--<?php echo esc_attr((string) ($notice['tone'] ?? 'muted')); ?>">
<?php echo esc_html((string) ($notice['message'] ?? '')); ?>
</div>
<?php
// 数据契约:\AKSRT\User\Home::get_profile_notice() 输出 state|label|text;
// 提示框色调修饰符与 state 同名(user-home.css:--banned/--restricted/--muted)。
$notice_state = (string) ($notice['state'] ?? '');
$notice_tone = in_array($notice_state, ['banned', 'restricted', 'muted'], true) ? $notice_state : 'muted';
$notice_label = trim((string) ($notice['label'] ?? ''));
$notice_text = trim((string) ($notice['text'] ?? ''));
$notice_message = $notice_label !== '' && $notice_text !== ''
? $notice_label . ',' . $notice_text
: ($notice_label !== '' ? $notice_label : $notice_text);
$notice_icon = 'muted' === $notice_state ? 'comment-slash' : 'ban';
?>
<?php if ($notice_message !== '') : ?>
<div class="aksrt-author-hero__notice aksrt-author-hero__notice--<?php echo esc_attr($notice_tone); ?>">
<i class="fa fas fa-<?php echo esc_attr($notice_icon); ?>" aria-hidden="true"></i>
<span><?php echo esc_html($notice_message); ?></span>
</div>
<?php endif; ?>
<?php endif; ?>
</div>