This commit is contained in:
Peter Maquiran
2023-08-08 09:43:26 +01:00
parent 834840fc41
commit 67a69d2e47
27 changed files with 153 additions and 54 deletions
+67 -2
View File
@@ -360,6 +360,12 @@ export class RoomService {
}
if(ChatMessage?.t == "au") {
this.updateContacts()
} else if (ChatMessage?.t == "r") {
this.name = ChatMessage.msg
}
setTimeout(() => {
done()
}, 5)
@@ -949,14 +955,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
}
}