fix(dialog): 撤回占位预存防闪动,重新编辑后占位保留至过期

- 确认撤回时先预存占位记录(原消息在列表时被去重压制不显示),消息移除的同一次重算中占位原地顶上,消除 WS 推送与接口响应竞争导致的先删后加闪动
- 撤回失败且消息仍在列表时才清除预存记录,兼容"接口报错但服务端实际已撤回"的情况
- 点"重新编辑"不再删除占位,保留至 5 分钟过期,期间可反复回填(对齐微信行为),同步更新 ai-kb 文档
This commit is contained in:
kuaifan 2026-07-16 22:11:04 +00:00
parent f7bc724e13
commit 844db09c12
2 changed files with 19 additions and 13 deletions

View File

@ -62,7 +62,7 @@ last_verified: v1.8.69
- 仅撤回**文本消息**(含 Markdown时出现「你撤回了一条消息 **重新编辑**」占位
- 占位只有自己可见,且只保存在执行撤回操作的这台设备本地(换设备、其他成员都看不到)
- 撤回后 **5 分钟内**有效,过期自动消失
- 点「重新编辑」:原内容回填到输入框(会覆盖输入框中已有内容),占位随即消失
- 点「重新编辑」:原内容回填到输入框(会覆盖输入框中已有内容)占位不会因此消失5 分钟内可反复点击,到期才自动消失
## 与「编辑」的区别

View File

@ -3786,6 +3786,20 @@ export default {
loading: true,
onOk: () => {
return new Promise((resolve, reject) => {
//
// WS
const preSaved = operateItem.type === 'text' && !!$A.getObject(operateItem.msg, 'text');
if (preSaved) {
this.$store.dispatch("saveDialogWithdraw", {
id: operateItem.id,
dialog_id: operateItem.dialog_id,
prev_id: operateItem.prev_id,
msg: {
type: $A.getObject(operateItem.msg, 'type'),
text: $A.getObject(operateItem.msg, 'text'),
},
});
}
this.$store.dispatch("call", {
url: 'dialog/msg/withdraw',
data: {
@ -3793,20 +3807,13 @@ export default {
},
}).then(() => {
resolve("消息已撤回");
if (operateItem.type === 'text' && $A.getObject(operateItem.msg, 'text')) {
this.$store.dispatch("saveDialogWithdraw", {
id: operateItem.id,
dialog_id: operateItem.dialog_id,
prev_id: operateItem.prev_id,
msg: {
type: $A.getObject(operateItem.msg, 'type'),
text: $A.getObject(operateItem.msg, 'text'),
},
});
}
this.$store.dispatch("forgetDialogMsg", operateItem);
}).catch(({msg}) => {
reject(msg);
// ""
if (preSaved && this.dialogMsgs.some(item => item.id == operateItem.id)) {
this.$store.dispatch("forgetDialogWithdraw", {id: operateItem.id});
}
});
})
}
@ -3825,7 +3832,6 @@ export default {
this.$refs.input.setContent(text.replace(/\{\{RemoteURL\}\}/g, $A.mainUrl()))
}
!this.windowTouch && this.inputFocus()
this.$store.dispatch("forgetDialogWithdraw", {id: source.id})
},
onViewReply(data) {