diff --git a/src/app/pages/chat/chat.page.ts b/src/app/pages/chat/chat.page.ts index b7670bf96..c887f2dc4 100644 --- a/src/app/pages/chat/chat.page.ts +++ b/src/app/pages/chat/chat.page.ts @@ -31,6 +31,7 @@ import { ThemeService } from 'src/app/services/theme.service' import { DataService } from 'src/app/services/data.service'; import { SqliteService } from 'src/app/services/sqlite.service'; import { StorageService } from 'src/app/services/storage.service'; +import { SessionStore } from 'src/app/store/session.service'; @@ -385,7 +386,7 @@ export class ChatPage implements OnInit { }) this.storageservice.get('chatusers').then((users) => { - this.dmUsers = users.filter(data => data.username != this.loggedUserChat.me.username); + this.dmUsers = users.filter(data => data.username != SessionStore.user.RochetChatUser); }) } else { this.sqlservice.getAllChatRoom().then((rooms: any) => { @@ -428,7 +429,7 @@ export class ChatPage implements OnInit { chatusersArray.push(userListDB); }); - this.dmUsers = chatusersArray.filter(data => data.username != this.loggedUserChat.me.username); + this.dmUsers = chatusersArray.filter(data => data.username != SessionStore.user.RochetChatUser); }) } @@ -544,7 +545,7 @@ export class ChatPage implements OnInit { }) this.storageservice.get('chatusers').then((users) => { - this.dmUsers = users.filter(data => data.username != this.loggedUserChat.me.username); + this.dmUsers = users.filter(data => data.username != SessionStore.user.RochetChatUser); }) } else { this.sqlservice.getAllChatRoom().then((rooms: any) => { diff --git a/src/app/pages/chat/group-messages/group-messages.page.ts b/src/app/pages/chat/group-messages/group-messages.page.ts index 0adb06bfe..152a6eebf 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.ts +++ b/src/app/pages/chat/group-messages/group-messages.page.ts @@ -393,7 +393,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { this.chatService.getAllUsers().subscribe(res => { console.log(res); - this.allUsers = res['users'].filter(data => data.username != this.loggedUserChat.me.username); + this.allUsers = res['users'].filter(data => data.username != SessionStore.user.RochetChatUser); console.log(this.allUsers); }); } diff --git a/src/app/pages/chat/messages/contacts/contacts.page.ts b/src/app/pages/chat/messages/contacts/contacts.page.ts index 6680188d3..e8b834c54 100644 --- a/src/app/pages/chat/messages/contacts/contacts.page.ts +++ b/src/app/pages/chat/messages/contacts/contacts.page.ts @@ -56,7 +56,7 @@ export class ContactsPage implements OnInit { headers: this.headers, }; this.chatService.getAllUsers().subscribe((res:any)=>{ - console.log(res.users); + console.log('All users',res.users); this.contacts = res.users.filter(data => data.username != this.sessionStore.user.RochetChatUser); this.users = this.contacts.sort((a,b) => { if(a.name < b.name){ diff --git a/src/app/pages/chat/new-group/new-group.page.ts b/src/app/pages/chat/new-group/new-group.page.ts index 8fcd410e7..fb8bf8188 100644 --- a/src/app/pages/chat/new-group/new-group.page.ts +++ b/src/app/pages/chat/new-group/new-group.page.ts @@ -8,6 +8,7 @@ import { ChatService } from 'src/app/services/chat.service'; import { ProcessesService } from 'src/app/services/processes.service'; import { WsChatMethodsService } from 'src/app/services/chat/ws-chat-methods.service'; import { AuthService } from 'src/app/services/auth.service'; +import { SessionStore } from 'src/app/store/session.service'; @Component({ selector: 'app-new-group', @@ -62,6 +63,7 @@ export class NewGroupPage implements OnInit { } async createGroup(){ + console.log('NEW GROUP', SessionStore.user.RochetChatUser) let name = this.groupName.split(' ').join('-'); //Take out all special characters in string name = name.normalize("NFD").replace(/[\u0300-\u036f]/g, ""); @@ -73,11 +75,11 @@ export class NewGroupPage implements OnInit { let customFields = { "countDownDate":this.thedate } - res = await this.wsChatMethodsService.createPrivateRoom(name, this.loggedUserChat.me.username, customFields); + res = await this.wsChatMethodsService.createPrivateRoom(name, SessionStore.user.RochetChatUser, customFields); console.log(res); } else{ - res = await this.wsChatMethodsService.createPrivateRoom(name, this.loggedUserChat.me.username, customFields); + res = await this.wsChatMethodsService.createPrivateRoom(name, SessionStore.user.RochetChatUser, customFields); console.log(res); } diff --git a/src/app/shared/chat/new-group/new-group.page.ts b/src/app/shared/chat/new-group/new-group.page.ts index f2069114a..45b536e47 100644 --- a/src/app/shared/chat/new-group/new-group.page.ts +++ b/src/app/shared/chat/new-group/new-group.page.ts @@ -8,6 +8,7 @@ import { WsChatMethodsService } from 'src/app/services/chat/ws-chat-methods.serv import { DataService } from 'src/app/services/data.service'; import { ProcessesService } from 'src/app/services/processes.service'; import { GroupDurationPage } from 'src/app/shared/popover/group-duration/group-duration.page'; +import { SessionStore } from 'src/app/store/session.service'; import { GroupContactsPage } from '../group-messages/group-contacts/group-contacts.page'; @Component({ @@ -92,6 +93,7 @@ export class NewGroupPage implements OnInit{ } async createGroup(){ + console.log('NEW GROUP', this.loggedUserChat) let name = this.groupName.split(' ').join('-'); //Take out all special characters in string name = name.normalize("NFD").replace(/[\u0300-\u036f]/g, ""); @@ -103,11 +105,11 @@ export class NewGroupPage implements OnInit{ let customFields = { "countDownDate":this.thedate } - res = await this.wsChatMethodsService.createPrivateRoom(name, this.loggedUserChat.me.username, customFields); + res = await this.wsChatMethodsService.createPrivateRoom(name, SessionStore.user.RochetChatUser, customFields); console.log(res); } else{ - res = await this.wsChatMethodsService.createPrivateRoom(name, this.loggedUserChat.me.username, customFields); + res = await this.wsChatMethodsService.createPrivateRoom(name, SessionStore.user.RochetChatUser, customFields); console.log(res); }