diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/chat.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/chat.component.ts index 0dd8874f..87c54e4c 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/chat.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/chat.component.ts @@ -20,7 +20,8 @@ import { Subscription, combineLatest, Observable } from 'rxjs'; import { RoomInfo, UserInfoShort, - UserInfo as RoomUserInfo + UserInfo as RoomUserInfo, + RoomType } from '@ucap-webmessenger/protocol-room'; import * as AppStore from '@app/store'; import * as ChatStore from '@app/store/messenger/chat'; @@ -288,9 +289,14 @@ export class ChatComponent implements OnInit, OnDestroy, AfterViewChecked { value => roomInfo.roomSeq === value.roomSeq ); if (-1 < i) { - return this.roomUserShortList[i].userInfos.filter( - user => user.isJoinRoom - ); + if (roomInfo.roomType === RoomType.Single) { + // Ignore type of joinRoom for Single Room. + return this.roomUserShortList[i].userInfos; + } else { + return this.roomUserShortList[i].userInfos.filter( + user => user.isJoinRoom + ); + } } } diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/right-drawer/room-user-list.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/right-drawer/room-user-list.component.ts index 647c15aa..d0317acf 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/right-drawer/room-user-list.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/right-drawer/room-user-list.component.ts @@ -6,7 +6,7 @@ import { EventEmitter, ViewChild } from '@angular/core'; -import { Subscription } from 'rxjs'; +import { Subscription, combineLatest } from 'rxjs'; import { Store, select } from '@ngrx/store'; import { tap, map, take } from 'rxjs/operators'; @@ -86,16 +86,22 @@ export class RoomUserListComponent implements OnInit, OnDestroy { } ngOnInit() { - this.userInfoListSubscription = this.store - .pipe( - select(AppStore.MessengerSelector.RoomSelector.selectUserinfolist), - tap(userInfoList => { - this.userInfoList = userInfoList - .filter(userInfo => userInfo.isJoinRoom === true) - .sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0)); + this.userInfoListSubscription = combineLatest([ + this.store.pipe( + select(AppStore.MessengerSelector.RoomSelector.selectUserinfolist) + ), + this.store.pipe(select(AppStore.MessengerSelector.RoomSelector.roomInfo)) + ]).subscribe(([userInfoList, roomInfo]) => { + this.userInfoList = userInfoList + .filter(userInfo => { + if (roomInfo.roomType === RoomType.Single) { + return true; + } else { + return userInfo.isJoinRoom === true; + } }) - ) - .subscribe(); + .sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0)); + }); this.roomInfoSubscription = this.store .pipe(