Fix rendering same message
This commit is contained in:
parent
a928ceb6bb
commit
65037f432d
@ -289,7 +289,7 @@ export default class ChatBubbles {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Calls when message successfully sent and we have an id
|
// Calls when message successfully sent and we have an id
|
||||||
this.listenerSetter.add(rootScope)('message_sent', async(e) => {
|
this.listenerSetter.add(rootScope)('message_sent', (e) => {
|
||||||
const {storage, tempId, tempMessage, mid} = e;
|
const {storage, tempId, tempMessage, mid} = e;
|
||||||
|
|
||||||
// ! can't use peerId to validate here, because id can be the same in 'scheduled' and 'chat' types
|
// ! can't use peerId to validate here, because id can be the same in 'scheduled' and 'chat' types
|
||||||
@ -299,7 +299,8 @@ export default class ChatBubbles {
|
|||||||
|
|
||||||
//this.log('message_sent', e);
|
//this.log('message_sent', e);
|
||||||
|
|
||||||
await getHeavyAnimationPromise();
|
// cannot use it here because new message will be rendered again
|
||||||
|
// await getHeavyAnimationPromise();
|
||||||
|
|
||||||
const mounted = this.getMountedBubble(tempId, tempMessage) || this.getMountedBubble(mid);
|
const mounted = this.getMountedBubble(tempId, tempMessage) || this.getMountedBubble(mid);
|
||||||
if(mounted) {
|
if(mounted) {
|
||||||
@ -330,13 +331,15 @@ export default class ChatBubbles {
|
|||||||
const container = findUpClassName(div, 'document-container');
|
const container = findUpClassName(div, 'document-container');
|
||||||
|
|
||||||
if(!tempMessage.media?.document?.thumbs?.length && message.media.document.thumbs?.length) {
|
if(!tempMessage.media?.document?.thumbs?.length && message.media.document.thumbs?.length) {
|
||||||
const timeSpan = div.querySelector('.time');
|
getHeavyAnimationPromise().then(() => {
|
||||||
const newDiv = wrapDocument({message});
|
const timeSpan = div.querySelector('.time');
|
||||||
div.replaceWith(newDiv);
|
const newDiv = wrapDocument({message});
|
||||||
|
div.replaceWith(newDiv);
|
||||||
if(timeSpan) {
|
|
||||||
newDiv.querySelector('.document-size').append(timeSpan);
|
if(timeSpan) {
|
||||||
}
|
newDiv.querySelector('.document-size').append(timeSpan);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if(container) {
|
if(container) {
|
||||||
|
Loading…
Reference in New Issue
Block a user