diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 528ae816a..c400bb31b 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -1,4 +1,4 @@ -/// +// import { Component, OnInit, NgZone } from '@angular/core'; import { EventsService } from '../services/events.service'; import { Event } from '../models/event.model'; @@ -12,8 +12,8 @@ import { Router } from '@angular/router'; import { ViewEventPage } from '../pages/agenda/view-event/view-event.page'; import { ApproveEventModalPage } from '../pages/agenda/approve-event-modal/approve-event-modal.page'; import { ExpedienteDetailPage } from '../pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page'; -import { PublicationDetailPage } from '../pages/publications/publication-detail/publication-detail.page'; import { ViewPublicationsPage } from '../pages/publications/view-publications/view-publications.page'; +import { PublicationDetailPage } from '../pages/publications/view-publications/publication-detail/publication-detail.page'; /* const { PushNotifications, LocalNotifications, LocalNotificationAction } = Plugins; */ @@ -73,6 +73,7 @@ export class HomePage implements OnInit { ngOnInit() { + //Add a test //this.pushCordova(); //Initialize profile as mdgpr diff --git a/src/app/shared/popover/chat-popover/chat-popover.page.ts b/src/app/shared/popover/chat-popover/chat-popover.page.ts index cae809bb3..e44a2188c 100644 --- a/src/app/shared/popover/chat-popover/chat-popover.page.ts +++ b/src/app/shared/popover/chat-popover/chat-popover.page.ts @@ -9,7 +9,8 @@ import { ChatService } from 'src/app/services/chat.service'; styleUrls: ['./chat-popover.page.scss'], }) export class ChatPopoverPage implements OnInit { - room:any; + roomId:string; + room: any; constructor( private popoverController: PopoverController, @@ -17,11 +18,11 @@ export class ChatPopoverPage implements OnInit { private navParams: NavParams, private chatService: ChatService, ) { - this.room = this.navParams.get('room'); + this.roomId = this.navParams.get('roomId'); } ngOnInit() { - console.log(this.room); + console.log(this.roomId); } close(){ @@ -36,39 +37,50 @@ export class ChatPopoverPage implements OnInit { //Top menu options //Close leaveGroup(){ - let body = { "roomId":this.room._id, } - if(this.room.t === 'p'){ - this.chatService.closeGroup(body).subscribe(res=>{ - console.log(res); - }); - } - else{ - this.chatService.closeChannel(body).subscribe(res=>{ - console.log(res); - }); - } + let body = { "roomId":this.roomId, } + + this.chatService.getRoomInfo(this.roomId).subscribe(room=>{ + this.room = room['room']; + + if(this.room.t === 'p'){ + this.chatService.closeGroup(body).subscribe(res=>{ + console.log(res); + }); + } + else{ + this.chatService.closeChannel(body).subscribe(res=>{ + console.log(res); + }); + } + + + }); this.popoverController.dismiss(true); } //Delete deleteGroup(){ - let body = { "roomId":this.room._id, } - if(this.room.t === 'p'){ - this.chatService.deleteGroup(body).subscribe(res=>{ - console.log(res); - }); - } - else{ - this.chatService.deleteChannel(body).subscribe(res=>{ - console.log(res); - }); - } + let body = { "roomId":this.roomId, } + this.chatService.getRoomInfo(this.roomId).subscribe(room=>{ + this.room = room['room']; + + if(this.room.t === 'p'){ + this.chatService.deleteGroup(body).subscribe(res=>{ + console.log(res); + }); + } + else{ + this.chatService.deleteChannel(body).subscribe(res=>{ + console.log(res); + }); + } + }); this.popoverController.dismiss(true); } async openChangeGroupName(){ const modal = await this.modalController.create({ component: EditGroupPage, componentProps: { - room: this.room, + //room: this.room, }, cssClass: 'contacts', backdropDismiss: false