This commit is contained in:
Peter Maquiran
2022-02-08 19:17:44 +01:00
parent 31fc4039d2
commit 53fbba4094
6 changed files with 60 additions and 51 deletions
@@ -69,6 +69,39 @@ export class WsChatMethodsService {
}
})
// console.log("ROOMS" + JSON.stringify(rooms))
// this.WsChatService.registerCallback({
// type:'Onmessage',
// funx:(message) => {
// if(message.msg =='changed' && message.collection == "stream-room-messages") {
// if(message.fields.args[0].rid) {
// // new message
// const ChatMessage = message.fields.args[0]
// const messageId = ChatMessage.rid
// setTimeout(()=>{
// this.sortRoomList()
// }, 100)
// }
// }
// if(message.msg =='changed' && message.collection == "stream-notify-room") {
// if(message.fields.eventName.includes('deleteMessage')){
// // delete message
// const DeletedMessageId = message.fields.args[0]._id;
// setTimeout(()=>{
// this.sortRoomList()
// }, 100)
// }
// }
// }
// })
}
getRoomFromDb() {
@@ -132,32 +165,6 @@ export class WsChatMethodsService {
this._dm = []
this._group = []
// console.log("ROOMS" + JSON.stringify(rooms))
this.WsChatService.registerCallback({
type:'Onmessage',
funx:(message)=>{
if(message.msg =='changed' && message.collection == "stream-room-messages") {
if(message.fields.args[0].rid) {
setTimeout(()=>{
this.sortRoomList()
}, 100)
}
}
if(message.msg =='changed' && message.collection == "stream-notify-room") {
if(message.fields.eventName.includes('deleteMessage')){
setTimeout(()=>{
this.sortRoomList()
}, 100)
}
}
}
})
await rooms.result.update.forEach( async (roomData: room) => {
await this.prepareRoom(roomData);
});
@@ -276,20 +283,20 @@ export class WsChatMethodsService {
*/
private getUserStatus(id?:string) {
this.WsChatService.getUserStatus((d) => {
// this.WsChatService.getUserStatus((d) => {
const username = d.fields.args[0][1]
const statusNum = d.fields.args[0][2]
// const username = d.fields.args[0][1]
// const statusNum = d.fields.args[0][2]
const statusText = this.statusNumberToText(statusNum)
// const statusText = this.statusNumberToText(statusNum)
const user = this.getUserByName(username)
// const user = this.getUserByName(username)
if(user) {
user.status = statusText
}
// if(user) {
// user.status = statusText
// }
})
// })
}