mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
fix chat message not showing
This commit is contained in:
@@ -136,33 +136,7 @@ export class MessageService {
|
||||
|
||||
const params = {roomId:this.rid, msg:this.msg, localReference: this.localReference}
|
||||
|
||||
this.ChatMethodsService.send(params).subscribe(
|
||||
(response: any) => {
|
||||
const ChatMessage = response.message
|
||||
this.messageSend = true
|
||||
this.redefinedMessage(ChatMessage)
|
||||
|
||||
},
|
||||
(error) => {
|
||||
this.WsChatService.registerCallback({
|
||||
type: 'reConnect',
|
||||
funx: async ()=> {
|
||||
|
||||
this.WsChatService.send(params).then(({message, requestId}) => {
|
||||
let ChatMessage = message.result
|
||||
this.messageSend = true
|
||||
this.redefinedMessage(ChatMessage)
|
||||
|
||||
})
|
||||
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
)
|
||||
|
||||
await this.sendRequest(params)
|
||||
|
||||
} else {
|
||||
|
||||
@@ -182,31 +156,7 @@ export class MessageService {
|
||||
|
||||
|
||||
const params = {roomId:this.rid, msg: this.msg, attachments: this.attachments, file: this.file, localReference: this.localReference}
|
||||
this.ChatMethodsService.send(params).subscribe(
|
||||
(response: any) => {
|
||||
const ChatMessage = response.message
|
||||
this.messageSend = true
|
||||
this.redefinedMessage(ChatMessage)
|
||||
|
||||
},
|
||||
(error) => {
|
||||
|
||||
this.WsChatService.registerCallback({
|
||||
type: 'reConnect',
|
||||
funx: async ()=> {
|
||||
this.WsChatService.send(params).then(({message, requestId}) => {
|
||||
let ChatMessage = message.result
|
||||
this.messageSend = true
|
||||
this.redefinedMessage(ChatMessage)
|
||||
|
||||
})
|
||||
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
)
|
||||
await this.sendRequest(params)
|
||||
|
||||
|
||||
} else if(this.WsChatService.isLogin == false) {
|
||||
@@ -232,6 +182,32 @@ export class MessageService {
|
||||
|
||||
}
|
||||
|
||||
async sendRequest(params) {
|
||||
this.ChatMethodsService.send(params).subscribe(
|
||||
(response: any) => {
|
||||
const ChatMessage = response.message
|
||||
this.messageSend = true
|
||||
this.redefinedMessage(ChatMessage)
|
||||
|
||||
},
|
||||
(error) => {
|
||||
this.WsChatService.registerCallback({
|
||||
type: 'reConnect',
|
||||
funx: async ()=> {
|
||||
|
||||
this.WsChatService.send(params).then(({message, requestId}) => {
|
||||
let ChatMessage = message.result
|
||||
this.messageSend = true
|
||||
this.redefinedMessage(ChatMessage)
|
||||
|
||||
})
|
||||
return true
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async redefinedMessage(ChatMessage , update = true) {
|
||||
ChatMessage = this.NfService.fix_updatedAt(ChatMessage)
|
||||
|
||||
@@ -259,17 +235,7 @@ export class MessageService {
|
||||
return this.u.username != SessionStore.user.RochetChatUser
|
||||
}
|
||||
|
||||
async delete(allMemberThatIsNotOffline) {
|
||||
|
||||
|
||||
|
||||
DeleteMessageModel.create({
|
||||
messageId: this._id,
|
||||
rid: this.rid,
|
||||
ts: this.ts,
|
||||
u: this.u,
|
||||
receivedBy: allMemberThatIsNotOffline
|
||||
})
|
||||
async delete() {
|
||||
|
||||
const message = await MessageModel.get({_id: this._id})
|
||||
await message.delete()
|
||||
@@ -312,6 +278,7 @@ export class MessageService {
|
||||
|
||||
delete message.id
|
||||
const createdMessage = await MessageModel.create(message)
|
||||
console.log('done add to db')
|
||||
|
||||
this.id = createdMessage.id
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user