mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
fix message order
This commit is contained in:
@@ -39,6 +39,7 @@ export class RoomService {
|
|||||||
name = ''
|
name = ''
|
||||||
_updatedAt = {}
|
_updatedAt = {}
|
||||||
hasLoadHistory = false
|
hasLoadHistory = false
|
||||||
|
hasLoadHistoryMessageRF = []
|
||||||
restoreFromOffline = false
|
restoreFromOffline = false
|
||||||
duration = ''
|
duration = ''
|
||||||
isTyping = false
|
isTyping = false
|
||||||
@@ -516,7 +517,7 @@ export class RoomService {
|
|||||||
*/
|
*/
|
||||||
async send({file = null, attachments = null, temporaryData = {}}) {
|
async send({file = null, attachments = null, temporaryData = {}}) {
|
||||||
|
|
||||||
const localReference = uuidv4()
|
const localReference = uuidv4();
|
||||||
|
|
||||||
let offlineChatMessage = {
|
let offlineChatMessage = {
|
||||||
rid: this.id,
|
rid: this.id,
|
||||||
@@ -547,7 +548,9 @@ export class RoomService {
|
|||||||
this.sortRoomList()
|
this.sortRoomList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this.hasLoadHistory == false) {
|
||||||
|
this.hasLoadHistoryMessageRF.push(localReference)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -703,6 +706,28 @@ export class RoomService {
|
|||||||
}, 50)
|
}, 50)
|
||||||
|
|
||||||
this.hasLoadHistory = true
|
this.hasLoadHistory = true
|
||||||
|
this.messageReorder();
|
||||||
|
}
|
||||||
|
|
||||||
|
async messageReorder() {
|
||||||
|
const reorderMessage: MessageService[] = this.messages.filter((message) =>
|
||||||
|
this.hasLoadHistoryMessageRF.includes(message?.localReference)
|
||||||
|
);
|
||||||
|
|
||||||
|
await this.messages.forEach( async (message, i) => {
|
||||||
|
|
||||||
|
if(this.hasLoadHistoryMessageRF.includes(message?.localReference)) {
|
||||||
|
this.messages.splice(i, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
this.hasLoadHistoryMessageRF = [];
|
||||||
|
|
||||||
|
reorderMessage.forEach((message) => {
|
||||||
|
this.messages.push(message)
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user