{loadError ? '群组管理加载失败' : '加载中…'}
diff --git a/src/views/group-management-view.jsx b/src/views/group-management-view.jsx index c62984b8..2a78f083 100644 --- a/src/views/group-management-view.jsx +++ b/src/views/group-management-view.jsx @@ -649,6 +649,7 @@ function Governance({topic, myRole, tinode, onToast}) { // and returns, so this is one of the highest-traffic pages in the file. const [gov, setGov] = React.useState(() => (topic && readCachedData('group-governance:' + topic)) || null); const [dissolving, setDissolving] = React.useState(false); + const [confirmingDissolve, setConfirmingDissolve] = React.useState(false); const [loadError, setLoadError] = React.useState(false); React.useEffect(() => { if (!topic) return; @@ -664,18 +665,27 @@ function Governance({topic, myRole, tinode, onToast}) { updateGroupGovernance(topic, {[key]: value, version: gov ? gov.version : 0}).then(data => { writeCachedData('group-governance:' + topic, data); setGov(data); }) .catch(err => onToast(err.message || '设置失败')); }; - const dissolve = () => { + // 原来是裸 window.confirm()——本工程已经在"退出登录"那次修复里明确认定这类原生弹窗和 + // 其余确认弹层不一致(personal-settings-view.jsx 的 LogoutConfirm/ConfirmSheet 那条注释: + // "a native confirm() is also environment-dependent: some embedded WebViews/kiosk contexts + // disable synchronous dialogs outright...silently preventing [the action] with no error + // shown")。解散群组同样不可逆、后果同样重大,却是本文件里唯一还在用 window.confirm() 的 + // 危险操作——本文件自己在 OwnerSelect 里已经有现成的同款弹层视觉语言(.group-sheet-backdrop + // /.group-confirm-sheet),改成两段式状态复用它,不再依赖浏览器原生对话框。 + const requestDissolve = () => { // Backend already refuses to actually destroy the group for a non-owner (the same native // {del hard:true} call it silently downgrades into "remove me from this group" instead) -- // but that response is indistinguishable from a real success, so without this gate a member // who somehow lands on this page got told "群聊已解散" when they'd really just left it. if (myRole !== 'owner') return; - if (!window.confirm('解散后群聊将无法恢复,确定要解散该群聊吗?')) return; + setConfirmingDissolve(true); + }; + const dissolve = () => { const t = tinode ? tinode.getTopic(topic) : null; - if (!t) return; + if (!t) { setConfirmingDissolve(false); return; } setDissolving(true); t.delTopic(true).then(() => { onToast('群聊已解散'); navigate('group-list'); }) - .catch(err => onToast(err.message || '解散失败')).finally(() => setDissolving(false)); + .catch(err => { onToast(err.message || '解散失败'); setConfirmingDissolve(false); }).finally(() => setDissolving(false)); }; if (!gov) return
{loadError ? '群组管理加载失败' : '加载中…'}
解散后群聊将无法恢复,确定要解散该群聊吗?
+ + +