fix: mute records get an unban entry on the restrictions tab

The record list rendered an action only for global ban/suspend rows, so
mute (禁言) rows showed an empty 操作 column with no way to lift them.
- record list: active mute rows now render a 解除禁言 button
- unban view: falls back to the active mute record when no ban/suspend
  exists, with 解除禁言/禁言中 titles (ban > suspend > mute precedence
  preserved); lifting still goes through lift_user_restriction (mute
  included by default)
- contract tests: cover the mute action link and the unban-view fallback
This commit is contained in:
2026-09-20 16:22:47 +08:00
parent 0df6e760e3
commit a1eb545bef
2 changed files with 33 additions and 5 deletions
@@ -254,9 +254,14 @@ test('comments expose a report entry for other users when reporting is enabled',
test('restrictions tab mirrors the reference ban modal 1:1', () => {
// 禁封方式/禁封时间/预置原因徽章/禁封说明/删除全部内容/禁止用户申诉,
// 以及已禁封用户的状态信息与解封留言表单(zib_get_set_user_ban_modal 同构)。
for (const label of ['拉入小黑屋', '禁封用户', '禁封方式', '禁封时间', '选择禁封原因', '其它原因', '禁封说明', '删除全部内容', '禁止用户申诉', '请填写禁止申诉说明', '解封用户', '移出小黑屋', '小黑屋禁封中', '禁封中(禁止登录)', '给用户的留言', '开始时间', '结束时间']) {
for (const label of ['拉入小黑屋', '禁封用户', '禁封方式', '禁封时间', '选择禁封原因', '其它原因', '禁封说明', '删除全部内容', '禁止用户申诉', '请填写禁止申诉说明', '解封用户', '移出小黑屋', '解除禁言', '小黑屋禁封中', '禁封中(禁止登录)', '禁言中', '给用户的留言', '开始时间', '结束时间']) {
assert.ok(usersMenus.includes(label), `restrictions tab missing reference label: ${label}`)
}
// 禁言(mute)记录在操作列提供“解除禁言”入口,且解除视图能选中 mute 记录
// (此前操作列对 mute 为空、顶部视图只认 ban/suspend,禁言无法从后台解除)。
assert.match(usersMenus, /\$type === 'mute'/)
assert.match(usersMenus, /'mute'\s*=>\s*__\('解除禁言', 'aksrt'\)/)
assert.match(usersMenus, /\$unban && \$current === null/)
// 时长选项 1/7/14/30/100/永久(默认 7 天);类型映射:小黑屋→suspend,禁封→ban。
assert.match(usersMenus, /1 => __\('1天', 'aksrt'\)/)
assert.match(usersMenus, /7 => __\('7天', 'aksrt'\)/)