mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
fix create chat
This commit is contained in:
@@ -42,32 +42,13 @@ export class ContactsPage implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
// this.chatService.refreshtoken();
|
||||
this.loadUsers();
|
||||
// this.loadUsers();
|
||||
|
||||
}
|
||||
onChange(event){
|
||||
this.textSearch = event.detail.value;
|
||||
}
|
||||
|
||||
loadUsers(){
|
||||
|
||||
this.chatService.getAllUsers().subscribe((res:any) => {
|
||||
|
||||
this.contacts = res.users.filter(data => data.username != this.sessionStore.user.UserName);
|
||||
this.users = this.contacts.sort((a,b) => {
|
||||
if(a.name < b.name){
|
||||
return -1;
|
||||
}
|
||||
if(a.name > b.name){
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
this.showLoader = false;
|
||||
}, (error) =>{
|
||||
// this.chatService.refreshtoken();
|
||||
});
|
||||
}
|
||||
|
||||
separateLetter(record, recordIndex, records){
|
||||
if(recordIndex == 0){
|
||||
@@ -92,14 +73,13 @@ export class ContactsPage implements OnInit {
|
||||
|
||||
clicked() {}
|
||||
|
||||
createRoom(username:string){
|
||||
createRoom(username:string) {
|
||||
let body = {
|
||||
username: username,
|
||||
}
|
||||
this.chatService.createRoom(body).subscribe(async(res) => {
|
||||
|
||||
this.room = res['room'];
|
||||
|
||||
await this.ChatSystemService.getAllRooms();
|
||||
this.getDirectMessage(this.room._id);
|
||||
});
|
||||
@@ -107,15 +87,8 @@ export class ContactsPage implements OnInit {
|
||||
|
||||
getDirectMessage(roomId:any) {
|
||||
|
||||
this.openModal(roomId);
|
||||
|
||||
this.chatService.getAllDirectMessages().subscribe(res=>{
|
||||
let result = res['ims'].filter(data => data._id == roomId);
|
||||
|
||||
|
||||
this.dm = result[0];
|
||||
|
||||
this.openModal(this.dm._id);
|
||||
});
|
||||
}
|
||||
|
||||
async openModal(roomId:any){
|
||||
@@ -133,11 +106,4 @@ export class ContactsPage implements OnInit {
|
||||
modal.onDidDismiss();
|
||||
}
|
||||
|
||||
async openMessages(username:string){
|
||||
|
||||
let dm:any;
|
||||
this.createRoom(username);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user