mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
remove duplicate
This commit is contained in:
@@ -530,9 +530,9 @@ export class RoomService {
|
||||
|
||||
this.message= ''
|
||||
|
||||
this.messagesLocalReference.push(localReference)
|
||||
const message: MessageService = await this.prepareCreate({message:offlineChatMessage, save: environment.chatOffline})
|
||||
|
||||
this.messagesLocalReference.push(localReference)
|
||||
await message.addMessageDB()
|
||||
message.send()
|
||||
|
||||
@@ -822,7 +822,33 @@ export class RoomService {
|
||||
wewMessage.setData(message)
|
||||
wewMessage.loadHistory = this.hasLoadHistory
|
||||
|
||||
this.messages.push(wewMessage)
|
||||
|
||||
let found;
|
||||
|
||||
if(wewMessage.localReference != null) {
|
||||
found = this.messages.find((MessageService, index) => {
|
||||
if ( MessageService.localReference == wewMessage.localReference ) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
} else {
|
||||
found = this.messages.find((MessageService, index) => {
|
||||
if ( MessageService._id == wewMessage._id) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
if (!found) {
|
||||
this.messages.push(wewMessage)
|
||||
return wewMessage
|
||||
}
|
||||
|
||||
return wewMessage
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user