pull made

This commit is contained in:
Eudes Inácio
2023-08-08 15:41:52 +01:00
28 changed files with 169 additions and 60 deletions
+69 -2
View File
@@ -360,6 +360,14 @@ export class RoomService {
}
console.log('ChatMessage', ChatMessage)
if(ChatMessage?.t == "au" || ChatMessage?.t == "ru" || ChatMessage?.t == "ul") {
this.updateContacts()
} else if (ChatMessage?.t == "r") {
this.name = ChatMessage.msg
}
setTimeout(() => {
done()
}, 5)
@@ -949,14 +957,73 @@ export class RoomService {
this.messageUnread = false
}
addContacts(userId:any) {
async addContacts(userId:any) {
let body = {
"roomId": this.id,
"userId": userId,
}
return this.chatService.addUserToGroup(body).toPromise();
await this.chatService.addUserToGroup(body).toPromise();
this.ChatSystemService.getGroupRoom(this.id).updateContacts()
}
async updateContacts() {
let res
let error = false
if(this.t == 'd') {
try {
res = await this.chatService.getMembers(this.id).toPromise();
} catch (e) {
await this.chatService.refreshtoken();
error = true
}
if(error) {
res = await this.chatService.getMembers(this.id).toPromise();
}
} else {
if (this.t === 'p') {
try {
res = await this.chatService.getGroupMembers(this.id).toPromise()
} catch (e) {
await this.chatService.refreshtoken();
error = true
}
if(error) {
res = await this.chatService.getGroupMembers(this.id).toPromise()
}
}
else {
try {
res = await this.chatService.getChannelMembers(this.id).toPromise()
} catch (e) {
await this.chatService.refreshtoken();
error = true
}
if(error) {
res = await this.chatService.getChannelMembers(this.id).toPromise()
}
}
}
const members = res['members'];
const users = members.filter(data => data.username != this.sessionStore.user.UserName);
this.members = members
this.membersExcludeMe = users
}
}