bugfix :: 1:1대화방에서 상대방이 방나가기 했을 경우 대화상대없음 으로 나오는 문제 수정.

This commit is contained in:
leejinho 2020-03-25 12:12:36 +09:00
parent 9a98298aa1
commit 8e43d5599b
2 changed files with 26 additions and 14 deletions

View File

@ -20,7 +20,8 @@ import { Subscription, combineLatest, Observable } from 'rxjs';
import { import {
RoomInfo, RoomInfo,
UserInfoShort, UserInfoShort,
UserInfo as RoomUserInfo UserInfo as RoomUserInfo,
RoomType
} from '@ucap-webmessenger/protocol-room'; } from '@ucap-webmessenger/protocol-room';
import * as AppStore from '@app/store'; import * as AppStore from '@app/store';
import * as ChatStore from '@app/store/messenger/chat'; import * as ChatStore from '@app/store/messenger/chat';
@ -288,11 +289,16 @@ export class ChatComponent implements OnInit, OnDestroy, AfterViewChecked {
value => roomInfo.roomSeq === value.roomSeq value => roomInfo.roomSeq === value.roomSeq
); );
if (-1 < i) { if (-1 < i) {
if (roomInfo.roomType === RoomType.Single) {
// Ignore type of joinRoom for Single Room.
return this.roomUserShortList[i].userInfos;
} else {
return this.roomUserShortList[i].userInfos.filter( return this.roomUserShortList[i].userInfos.filter(
user => user.isJoinRoom user => user.isJoinRoom
); );
} }
} }
}
return []; return [];
} }

View File

@ -6,7 +6,7 @@ import {
EventEmitter, EventEmitter,
ViewChild ViewChild
} from '@angular/core'; } from '@angular/core';
import { Subscription } from 'rxjs'; import { Subscription, combineLatest } from 'rxjs';
import { Store, select } from '@ngrx/store'; import { Store, select } from '@ngrx/store';
import { tap, map, take } from 'rxjs/operators'; import { tap, map, take } from 'rxjs/operators';
@ -86,16 +86,22 @@ export class RoomUserListComponent implements OnInit, OnDestroy {
} }
ngOnInit() { ngOnInit() {
this.userInfoListSubscription = this.store this.userInfoListSubscription = combineLatest([
.pipe( this.store.pipe(
select(AppStore.MessengerSelector.RoomSelector.selectUserinfolist), select(AppStore.MessengerSelector.RoomSelector.selectUserinfolist)
tap(userInfoList => { ),
this.store.pipe(select(AppStore.MessengerSelector.RoomSelector.roomInfo))
]).subscribe(([userInfoList, roomInfo]) => {
this.userInfoList = userInfoList this.userInfoList = userInfoList
.filter(userInfo => userInfo.isJoinRoom === true) .filter(userInfo => {
.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0)); if (roomInfo.roomType === RoomType.Single) {
return true;
} else {
return userInfo.isJoinRoom === true;
}
}) })
) .sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
.subscribe(); });
this.roomInfoSubscription = this.store this.roomInfoSubscription = this.store
.pipe( .pipe(