This commit is contained in:
tiago.kayaya
2021-04-20 13:22:25 +01:00
parent 77075b3473
commit d7e2f96c2c
4 changed files with 84 additions and 7 deletions
@@ -53,6 +53,7 @@ export class GroupContactsPage implements OnInit {
ngOnInit() {
this.loadUsers();
this.getMembers();
console.log(this.groupName);
console.log(this.isGroupCreated);
}
@@ -62,23 +63,35 @@ export class GroupContactsPage implements OnInit {
"roomId": this.room._id,
"userId": data._id,
}
console.log(this.room);
console.log(body);
if(this.room.t == "p"){
this.chatService.removeGroupMember(body).subscribe(res=>{
console.log(res);
this.loadUsers();
this.getMembers();
});
}
else if(this.room.t == "c"){
this.chatService.removeChannelMember(body).subscribe(res=>{
console.log(res);
this.loadUsers();
this.getMembers();
});
}
}
getMembers(){
if(this.room.t == "p"){
this.chatService.getGroupMembers(this.room._id).subscribe(res=>{
this.members = res['members'];
});
}
else if(this.room.t == "c"){
this.chatService.getChannelMembers(this.room._id).subscribe(res=>{
this.members = res['members'];
});
}
}
loadUsers(){
this.options = {
headers: this.headers,
@@ -90,7 +103,6 @@ export class GroupContactsPage implements OnInit {
else{
this.contacts = res.users.filter(data => data.username != this.loggedUser.me.username);
}
this.users = this.contacts.sort((a,b) => {
if(a.name < b.name){
return -1;
@@ -121,7 +133,8 @@ export class GroupContactsPage implements OnInit {
}
doRefresh(event){
this.loadUsers();
this.getMembers();
}
async close(){