mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
fix
This commit is contained in:
@@ -394,13 +394,13 @@ export class RoomService {
|
||||
|
||||
this.messages[i]?.delateDB()
|
||||
|
||||
console.log(_id,'==',this.messages[i]?._id, true)
|
||||
// console.log(_id,'==',this.messages[i]?._id, true)
|
||||
this.messages.splice(i, 1)
|
||||
|
||||
return true
|
||||
|
||||
} else {
|
||||
console.log(_id,'==',this.messages[i]?._id, false)
|
||||
// console.log(_id,'==',this.messages[i]?._id, false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -430,19 +430,20 @@ export class RoomService {
|
||||
await message.delateStatusFalse()
|
||||
|
||||
this.ChatMethodsService.deleteMessage({_id:msgId, msgId:msgId, roomId:message.rid}).subscribe(
|
||||
(response: any) => {
|
||||
async (response: any) => {
|
||||
|
||||
message.delateRequest = true
|
||||
message.save()
|
||||
await message.save()
|
||||
this.deleteMessage(msgId)
|
||||
|
||||
},
|
||||
(response) => {
|
||||
async (response) => {
|
||||
|
||||
if (response.error.error.startsWith('No message found with the id of')) {
|
||||
|
||||
this.deleteMessage(msgId)
|
||||
message.delateRequest = true
|
||||
await message.save()
|
||||
|
||||
} else {
|
||||
this.WsChatService.registerCallback({
|
||||
@@ -626,25 +627,25 @@ export class RoomService {
|
||||
await this.restoreMessageFromDB()
|
||||
}
|
||||
|
||||
await this.WsChatService.loadHistory(this.id, limit).then( async (chatHistory:chatHistory) => {
|
||||
// await this.WsChatService.loadHistory(this.id, limit).then( async (chatHistory:chatHistory) => {
|
||||
|
||||
console.log('load chatHistory', JSON.stringify(chatHistory))
|
||||
// console.log('load chatHistory', JSON.stringify(chatHistory))
|
||||
|
||||
const messagesId = this.messages.map((message)=> message._id)
|
||||
// const messagesId = this.messages.map((message)=> message._id)
|
||||
|
||||
chatHistory.result.messages.reverse().forEach(async(message: any) => {
|
||||
// chatHistory.result.messages.reverse().forEach(async(message: any) => {
|
||||
|
||||
if (!messagesId.includes(message._id)) {
|
||||
const messagesToSave = await this.prepareMessageCreateIfNotExist_iD({message: message});
|
||||
if(messagesToSave) {
|
||||
await messagesToSave.addMessageDB()
|
||||
}
|
||||
}
|
||||
// if (!messagesId.includes(message._id)) {
|
||||
// const messagesToSave = await this.prepareMessageCreateIfNotExist_iD({message: message});
|
||||
// if(messagesToSave) {
|
||||
// await messagesToSave.addMessageDB()
|
||||
// }
|
||||
// }
|
||||
|
||||
})
|
||||
// })
|
||||
|
||||
|
||||
})
|
||||
// })
|
||||
|
||||
setTimeout(() => {
|
||||
this.scrollDown()
|
||||
|
||||
Reference in New Issue
Block a user