mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 13:26:08 +00:00
show already selected members of the group chat
- filter list of available members to group chat
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ModalController, NavParams } from '@ionic/angular';
|
||||
import * as _ from 'lodash';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { ChatService } from 'src/app/services/chat.service';
|
||||
import { NewGroupPage } from '../../new-group/new-group.page';
|
||||
@@ -24,6 +25,7 @@ export class GroupContactsPage implements OnInit {
|
||||
contacts: any;
|
||||
textSearch:string;
|
||||
room:any;
|
||||
members:any;
|
||||
dm:any;
|
||||
isGroupCreated:boolean;
|
||||
groupName:string;
|
||||
@@ -46,6 +48,7 @@ export class GroupContactsPage implements OnInit {
|
||||
this.isGroupCreated = this.navParams.get('isCreated');
|
||||
this.groupName = this.navParams.get('name');
|
||||
this.room = this.navParams.get('room');
|
||||
this.members = this.navParams.get('members');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -59,21 +62,7 @@ export class GroupContactsPage implements OnInit {
|
||||
headers: this.headers,
|
||||
};
|
||||
this.chatService.getAllUsers().subscribe((res:any)=>{
|
||||
console.log(res.users);
|
||||
res.users.forEach(user =>{
|
||||
let usr = {
|
||||
"_id": user._id,
|
||||
"username": user.username,
|
||||
"name":user.name,
|
||||
"isChecked": false,
|
||||
}
|
||||
if(this.listContacts == null){
|
||||
this.listContacts = new Array();
|
||||
}
|
||||
this.listContacts.push(usr);
|
||||
});
|
||||
|
||||
this.contacts = this.listContacts.filter(data => data.username != this.loggedUser.me.username);
|
||||
this.contacts = res.users.filter(f => !this.members.some(item => item._id === f._id));
|
||||
this.users = this.contacts.sort((a,b) => {
|
||||
if(a.name < b.name){
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user