修复"我的收藏"批量删除仍用原生 window.confirm(),是本工程已确立模式里同一类问题的第三处

现象:跟已经修过的两处同一类问题(46a98782"退出登录"、4773ee5f"解散群组")一样,
content-library-view.jsx 的收藏批量删除也还在用裸 window.confirm(),4773ee5f 的提交
说明里已经点名记录过这一处、留给第七章处理。

根因:window.confirm() 与本工程其它确认弹层的视觉不一致,且部分内嵌 WebView/kiosk
环境会直接禁用同步对话框(confirm() 恒返回 false,删除被静默拦下、用户毫无感知)。

修法:改成两段式 state(点"删除"先进"确认中"态渲染弹层,弹层里的"确定"才真正调用
batchDeleteFavorites),新增 .library-sheet-backdrop/.library-confirm-sheet 样式,
数值抄自本文件已有的 .personal-*/.group-* 同款弹层(46a98782/4773ee5f),保持视觉
语言一致。

验证:真实浏览器注册全新测试账号,在一个真实群聊里发送并收藏两条消息,进入"我的
收藏"多选模式,选中两项后:先测"点删除→点取消"(弹层消失、两项收藏原样保留、未
发出任何 batch-delete 请求);再测"点删除→点确定"(真实 POST .../favorites/
batch-delete 200 成功、两项 ok:true、列表正确清空为"暂无此类收藏"、toast 提示
"已删除所选收藏")。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Your Name
2026-09-06 17:55:48 +08:00
co-authored by Claude Sonnet 5
parent c2e07a89b8
commit 31f2b4afea
3 changed files with 70 additions and 4 deletions
+56
View File
@@ -11422,6 +11422,62 @@ div.toast.show {
font-size: 0.72rem;
}
/* Same generic confirm-sheet look this app already uses in personal-settings-view.jsx
(.personal-sheet-backdrop/.personal-confirm-sheet, 46a98782) and group-management-view.jsx
(.group-sheet-backdrop/.group-confirm-sheet, 4773ee5f) -- each view file keeps its own
identically-styled copy under its own class prefix rather than a shared cross-file component. */
.library-sheet-backdrop {
display: grid;
position: absolute;
z-index: 70;
inset: 0;
place-items: center;
padding: 1rem;
background: rgba(22,26,31,0.52);
}
.library-confirm-sheet {
width: min(100%, 25rem);
padding: 1.25rem;
border-radius: 0.5rem;
background: #fff;
text-align: center;
}
.library-confirm-sheet > .material-icons {
color: #4d73aa;
font-size: 2.8rem;
}
.library-confirm-sheet h2 {
margin: 0.65rem 0;
font-size: 1.15rem;
}
.library-confirm-sheet p {
margin: 0.7rem 0 1rem;
color: #5c646e;
line-height: 1.6;
text-align: left;
}
.library-confirm-sheet button {
width: 100%;
min-height: 2.9rem;
margin: 0.45rem 0 0;
padding: 0 1rem;
border: 0;
border-radius: 0.35rem;
box-shadow: none;
color: #4d5660;
background: #f0f2f4;
}
.library-confirm-sheet button.danger {
color: #fff;
background: #d84950;
}
.library-section-title {
width: min(100%, 52rem);
margin: 0 auto;