diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts index 325f8f804..9299ace5c 100644 --- a/src/app/pages/chat/messages/messages.page.ts +++ b/src/app/pages/chat/messages/messages.page.ts @@ -162,6 +162,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { } ngOnInit() { + this.wsChatMethodsService.getAllRooms(); this.chatService.refreshtoken(); this.wsChatMethodsService.getUserOfRoom(this.roomId).then((value) => { diff --git a/src/app/shared/chat/messages/messages.page.ts b/src/app/shared/chat/messages/messages.page.ts index 80e84bbc2..db221790e 100644 --- a/src/app/shared/chat/messages/messages.page.ts +++ b/src/app/shared/chat/messages/messages.page.ts @@ -99,6 +99,10 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy audioDuration = 0; audioTimer:any; @ViewChild('range', {static: false}) range: IonRange; + room: any = new Array(); + roomName: any; + isAdmin = false; + roomCountDownDate: string; constructor( public popoverController: PopoverController, @@ -128,6 +132,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy } ngOnChanges(changes: SimpleChanges): void { + this.wsChatMethodsService.getAllRooms(); this.wsChatMethodsService.getDmRoom(this.roomId).loadHistory({}) this.wsChatMethodsService.getDmRoom(this.roomId).scrollDown = this.scrollToBottomClicked @@ -164,9 +169,9 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy } ngOnInit() { + this.wsChatMethodsService.getAllRooms(); this.chatService.refreshtoken(); this.scrollToBottom(); - this.getChatMembers(); this.deleteRecording(); @@ -1122,6 +1127,27 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy },1000) } + async getRoomInfo() { + 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; + } + } + }