This commit is contained in:
Peter Maquiran
2022-03-25 17:39:51 +01:00
parent f2cf316329
commit e2721f1091
2 changed files with 13 additions and 10 deletions
+7 -5
View File
@@ -77,17 +77,21 @@ export class MessageService {
this._id = _id
this._updatedAt = _updatedAt || new Date().getTime()
this.file = file
this.attachments = attachments
this.temporaryData = temporaryData
this.localReference = localReference || null
this.id = id
this.delate = delate
this.delateRequest = delateRequest
if(this.attachments?.length >= 1 && attachments?.length >= 1) {
this.attachments[0] = Object.assign(this.attachments[0], attachments[0])
} else {
this.attachments = attachments
}
this.viewed = [...new Set([...viewed,...this.viewed])];
this.received = [...new Set([...received,...this.received])];
if(!this.ts) {
this.offline = true
this.messageSend = false
@@ -105,11 +109,9 @@ export class MessageService {
}
if(this.hasFile) {
if(this.file.type != 'application/webtrix') {
this.displayType = this.file.type.replace('application/','').toUpperCase()
}
}
this.calDateDuration()
+6 -5
View File
@@ -238,7 +238,6 @@ export class RoomService {
const args = message.fields.args
// alert(JSON.stringify(args))
if (typeof args[1] != 'object') {
@@ -367,8 +366,7 @@ export class RoomService {
if(this.messages[i]?._id == id ) {
console.log(_id,'==',this.messages[i]?._id, true)
this.messages.splice(i, 1)
//Get previous last message from room
const previousLastMessage = this.messages.slice(-1)[0];
@@ -377,7 +375,7 @@ export class RoomService {
this.calDateDuration(previousLastMessage._updatedAt)
this.sortRoomList()
if (SessionStore.user.RochetChatUser == this.messages[i].u.username) {
if (SessionStore.user.RochetChatUser == this.messages[i]?.u?.username) {
const allMemberThatIsOffline = this.getAllMemberThatIsOffline()
DeleteMessageModel.create({
@@ -389,7 +387,10 @@ export class RoomService {
})
}
this.messages[i].delateDB()
this.messages[i]?.delateDB()
console.log(_id,'==',this.messages[i]?._id, true)
this.messages.splice(i, 1)
return true