mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
remove duplicate
This commit is contained in:
@@ -77,7 +77,7 @@ export class MessageService {
|
||||
this.ts = ts
|
||||
this.u = u || { name: this.usernameToDisplayName(SessionStore.user.UserName), username: SessionStore.user.UserName, _id: ""}
|
||||
this.t = t
|
||||
this._id = _id
|
||||
this._id = _id || ""
|
||||
this._updatedAt = _updatedAt || new Date().getTime()
|
||||
this.file = file
|
||||
this.temporaryData = temporaryData
|
||||
|
||||
@@ -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