diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/status/effects.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/status/effects.ts index bb2ee150..57b578b5 100644 --- a/projects/ucap-webmessenger-app/src/app/store/messenger/status/effects.ts +++ b/projects/ucap-webmessenger-app/src/app/store/messenger/status/effects.ts @@ -39,6 +39,7 @@ import { of } from 'rxjs'; import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; import { KEY_LOGIN_RES_INFO } from '@app/types'; +import { RoomType } from '@ucap-webmessenger/protocol-room'; @Injectable() export class Effects { @@ -159,15 +160,36 @@ export class Effects { () => this.actions$.pipe( ofType(RoomStore.infoSuccess), - map(action => action.userInfoList), - tap(userInfoList => { - if (!!userInfoList && userInfoList.length > 0) { - this.store.dispatch( - bulkInfo({ - divCd: 'roomuserBulk', - userSeqs: userInfoList.map(userinfo => userinfo.seq) - }) - ); + // map(action => action.userInfoList), + tap(action => { + if ( + !!action.userInfoList && + action.userInfoList.length > 0 && + (action.roomInfo.roomType === RoomType.Single || + action.roomInfo.roomType === RoomType.Multi) + ) { + let userSeqs = action.userInfoList + .filter(userInfo => userInfo.isJoinRoom) + .map(userinfo => userinfo.seq); + + // ignore my state. + const loginResInfo: LoginResponse = this.sessionStorageService.get< + LoginResponse + >(KEY_LOGIN_RES_INFO); + if (!!loginResInfo) { + userSeqs = userSeqs.filter( + userSeq => userSeq !== loginResInfo.userSeq + ); + } + + if (!!userSeqs && userSeqs.length > 0) { + this.store.dispatch( + bulkInfo({ + divCd: 'roomuserBulk', + userSeqs + }) + ); + } } }) ),