fix chat room names

This commit is contained in:
Peter Maquiran
2022-10-04 16:50:55 +01:00
parent ea89f72a33
commit a1f8d7461c
5 changed files with 39 additions and 7 deletions
@@ -42,7 +42,12 @@ export class EditGroupPage implements OnInit {
this.chatService.getRoomInfo(this.roomId).subscribe(room=>{
this.room = room['room'];
this.groupName = this.room.name.split('-').join(' ');
try {
this.groupName = this.room.name.split('-').join(' ');
} catch (error) {
this.groupName = this.room.name;
}
});
}
@@ -1,4 +1,4 @@
import { Component, OnChanges, OnInit, Input, SimpleChanges, ChangeDetectorRef, Output, EventEmitter, ViewChild, ElementRef, AfterViewInit, OnDestroy } from '@angular/core';
import { Component, OnChanges, OnInit, Input, SimpleChanges, ChangeDetectorRef, Output, EventEmitter, ViewChild, ElementRef, AfterViewInit, OnDestroy, ComponentFactoryResolver } from '@angular/core';
import { AnimationController, ModalController, PopoverController, Platform } from '@ionic/angular';
import { AlertService } from 'src/app/services/alert.service';
import { AuthService } from 'src/app/services/auth.service';
@@ -411,7 +411,12 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
// console.log('ROOM',room)
this.room = room['room'];
if (this.room.name) {
this.roomName = this.room.name.split('-').join(' ');
try {
this.roomName = this.room.name.split('-').join(' ');
} catch (error) {
this.roomName = this.room.name;
}
}
@@ -591,7 +596,14 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
this.openEditGroupPage.emit(this.roomId);
}
else {
this.roomName = res.data.name.split('-').join(' ');
try {
this.roomName = res.data.name.split('-').join(' ');
} catch (error) {
console.log(error);
console.log(res.data)
this.roomName = res.data.name
}
};
@@ -1139,7 +1139,12 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
// console.log('ROOM',room)
this.room = room['room'];
if (this.room.name) {
this.roomName = this.room.name.split('-').join(' ');
try {
this.roomName = this.room.name.split('-').join(' ');
} catch(error) {
this.roomName = this.room.name;
}
}