fix: 修改消息导致最后消息改变

This commit is contained in:
kuaifan 2024-03-02 13:07:27 +08:00
parent 2e70c9617c
commit 42d39a830e

View File

@ -1061,10 +1061,6 @@ export default {
return this.dialogData.extra_quote_id || 0 return this.dialogData.extra_quote_id || 0
}, },
quoteUpdate() {
return this.dialogData.extra_quote_type === 'update'
},
quoteData() { quoteData() {
return this.quoteId ? this.allMsgs.find(({id}) => id === this.quoteId) : null return this.quoteId ? this.allMsgs.find(({id}) => id === this.quoteId) : null
}, },
@ -1437,7 +1433,7 @@ export default {
.replace(/(<span\s+class="mention"(.*?)>.*?<\/span>.*?<\/span>.*?<\/span>)(\x20)?/, "$1 ") .replace(/(<span\s+class="mention"(.*?)>.*?<\/span>.*?<\/span>.*?<\/span>)(\x20)?/, "$1 ")
} }
// //
if (this.quoteUpdate) { if (this.dialogData.extra_quote_type === 'update') {
// //
if (textType === "text") { if (textType === "text") {
textBody = textBody.replace(new RegExp(`src=(["'])${$A.apiUrl('../')}`, "g"), "src=$1{{RemoteURL}}") textBody = textBody.replace(new RegExp(`src=(["'])${$A.apiUrl('../')}`, "g"), "src=$1{{RemoteURL}}")
@ -1462,7 +1458,7 @@ export default {
method: 'post', method: 'post',
complete: _ => this.$store.dispatch("cancelLoad", `msg-${update_id}`) complete: _ => this.$store.dispatch("cancelLoad", `msg-${update_id}`)
}).then(({data}) => { }).then(({data}) => {
this.sendSuccess(data) this.sendSuccess(data, 0, true)
this.onPositionId(update_id) this.onPositionId(update_id)
}).catch(({msg}) => { }).catch(({msg}) => {
$A.modalError(msg) $A.modalError(msg)
@ -2004,7 +2000,7 @@ export default {
} }
}, },
sendSuccess(data, tempId = 0) { sendSuccess(data, tempId = 0, isUpdate = false) {
if ($A.isArray(data)) { if ($A.isArray(data)) {
data.some(item => { data.some(item => {
this.sendSuccess(item, tempId) this.sendSuccess(item, tempId)
@ -2022,7 +2018,7 @@ export default {
}, 1000) }, 1000)
} }
this.$store.dispatch("saveDialogMsg", data); this.$store.dispatch("saveDialogMsg", data);
if (!this.quoteUpdate) { if (!isUpdate) {
this.$store.dispatch("increaseTaskMsgNum", data); this.$store.dispatch("increaseTaskMsgNum", data);
this.$store.dispatch("increaseMsgReplyNum", data); this.$store.dispatch("increaseMsgReplyNum", data);
this.$store.dispatch("updateDialogLastMsg", data); this.$store.dispatch("updateDialogLastMsg", data);