This commit is contained in:
Peter Maquiran
2022-02-10 21:50:15 +01:00
parent 54020c2247
commit 4b66eb6713
4 changed files with 28 additions and 21 deletions
+4 -6
View File
@@ -80,6 +80,8 @@ export class RoomService {
this._updatedAt = _updatedAt
this.calDateDuration()
this.restoreMessageFromDB()
}
@@ -94,7 +96,6 @@ export class RoomService {
"stream-room-messages",
(_ChatMessage) => {
console.log('recivemessage', _ChatMessage)
alert('receive and send to view')
let ChatMessage = _ChatMessage.fields.args[0]
ChatMessage = this.fix_updatedAt(ChatMessage)
@@ -270,7 +271,7 @@ export class RoomService {
*/
async send({file = null, attachments = null, temporaryData = {}}) {
const localReference = uuidv4() + 'peter'
const localReference = uuidv4()
let offlineChatMessage = {
rid: this.id,
@@ -403,7 +404,7 @@ export class RoomService {
if(wewMessage.offline == false) {
this.prepareMessage(ChatMessage)
} else {
if(environment.chatOffline) alert('create offline')
const offlineMessage = this.prepareMessage(ChatMessage)
this.messagesLocalReference.push(offlineMessage.localReference)
@@ -432,7 +433,6 @@ export class RoomService {
return false
}
}
await this.restoreMessageFromDB()
await this.WsChatService.loadHistory(this.id, limit).then( async (chatHistory:chatHistory) => {
console.log('loadHistory', chatHistory)
@@ -464,7 +464,6 @@ export class RoomService {
wewMessage.loadHistory = this.hasLoadHistory
if(!message._id && environment.chatOffline && save) {
if(this.hasLoadHistory && environment.chatOffline) alert('create offline')
this.messages.push(wewMessage)
return wewMessage
@@ -480,7 +479,6 @@ export class RoomService {
})
if (save && !found) {
if(this.hasLoadHistory && environment.chatOffline) alert('not found')
this.messages.push(wewMessage)
}