Bug on group chat options for admin

This commit is contained in:
Eudes Inácio
2022-07-01 14:28:57 +01:00
parent 93b7004410
commit 311996797b
3 changed files with 25 additions and 1 deletions
@@ -83,6 +83,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
showAvatar = true;
audioPermissionStatus: 'granted'| 'denied' | 'prompt' | null = null
sessionStore = SessionStore
isAdmin = false;
constructor(
private modalController: ModalController,
public popoverController: PopoverController,
@@ -364,7 +365,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
} catch (err) { }
}
getRoomInfo() {
async getRoomInfo() {
this.showLoader = true;
// this.chatService.getRoomInfo(this.roomId).subscribe(room => {
// this.room = room['room'];
@@ -375,6 +376,24 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
// this.getGroupContacts(this.room);
// this.showLoader = false;
// });
this.wsChatMethodsService.getGroupRoom(this.roomId).loadHistory({});
let room = await this.chatService.getRoomInfo(this.roomId).toPromise();
// console.log('ROOM',room)
this.room = room['room'];
if (this.room.name) {
this.roomName = this.room.name.split('-').join(' ');
}
if(SessionStore.user.ChatData.data.userId == this.room.u._id){
this.isAdmin = true
} else {
this.isAdmin = false
}
if (this.room.customFields.countDownDate) {
this.roomCountDownDate = this.room.customFields.countDownDate;
}
}
async getChatMembers() {
@@ -509,6 +528,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
componentProps: {
roomId: this.roomId,
members: this.members,
isAdmin: this.isAdmin,
},
});
await modal.present();