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 {
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
);
}
}
}

View File

@ -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(