This commit is contained in:
Peter Maquiran
2022-03-04 14:50:13 +01:00
parent c112080917
commit 4dd7c83279
4 changed files with 50 additions and 6 deletions
+27 -1
View File
@@ -273,6 +273,8 @@ export class RoomService {
temporaryData,
localReference
}
this.message= ''
const message: MessageService = await this.prepareMessage({message:offlineChatMessage, save: environment.chatOffline})
@@ -292,7 +294,7 @@ export class RoomService {
this.sortRoomList()
}
this.message= ''
}
@@ -570,6 +572,30 @@ export class RoomService {
}
/**
* @description find or create message
* @param message
* @param save
* @returns
*/
async prepareCreate({message}): Promise<MessageService> {
message = this.fix_updatedAt(message)
const wewMessage = new MessageService(this.storage, this.NfService, this.WsChatService, this.ChatStorageService, this.ChatMethodsService)
wewMessage.setData(message)
wewMessage.loadHistory = this.hasLoadHistory
if(!message?._id && environment.chatOffline) {
this.messages.push(wewMessage)
return wewMessage
}
}
simplePrepareMessage(message) {
message = this.fix_updatedAt(message)
const wewMessage = new MessageService(this.storage, this.NfService, this.WsChatService, this.ChatStorageService, this.ChatMethodsService)