bugfix :: 대화방에 제 3자가 다른 사람을 추가 했을 경우 방리스트의 인원이 갱신되지 않는 문제 수정.

This commit is contained in:
leejinho 2020-03-24 14:01:32 +09:00
parent 023571a874
commit a2461ae2e6
3 changed files with 76 additions and 4 deletions

View File

@ -188,3 +188,8 @@ export const exitFailure = createAction(
'[Messenger::Room] Exit Failure',
props<{ error: any }>()
);
export const syncRoomRefreshByInvite = createAction(
'[Messenger::Room] Sync Room Refresh by invite',
props<InfoRequest>()
);

View File

@ -70,7 +70,8 @@ import {
exitForcingFailure,
exitForcingSuccess,
exitNotificationOthers,
clearRoomUser
clearRoomUser,
syncRoomRefreshByInvite
} from './actions';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { LoginInfo, KEY_LOGIN_INFO, KEY_VER_INFO } from '@app/types';
@ -398,10 +399,11 @@ export class Effects {
)
),
tap(([action, roomInfo]) => {
const loginInfo = this.sessionStorageService.get<LoginInfo>(
KEY_LOGIN_INFO
);
if (!!roomInfo && roomInfo.roomSeq === action.noti.roomSeq) {
const loginInfo = this.sessionStorageService.get<LoginInfo>(
KEY_LOGIN_INFO
);
this.store.dispatch(
info({
roomSeq: action.noti.roomSeq,
@ -410,6 +412,15 @@ export class Effects {
})
);
}
// room list refresh for exist.
this.store.dispatch(
syncRoomRefreshByInvite({
roomSeq: action.noti.roomSeq,
isDetail: true,
localeCode: loginInfo.localeCode
})
);
})
);
},

View File

@ -540,6 +540,62 @@ export class Effects {
},
{ dispatch: false }
);
syncRoomRefreshByInvite$ = createEffect(
() => {
let roomInfo: RoomInfo;
let userInfoShortList: UserInfoShort[];
let userInfoList: RoomUserInfo[];
return this.actions$.pipe(
ofType(RoomStore.syncRoomRefreshByInvite),
tap(() => {
roomInfo = null;
userInfoShortList = [];
userInfoList = [];
}),
withLatestFrom(
this.store.pipe(
select((state: any) => state.messenger.sync.room.ids as string[])
)
),
switchMap(([req, roomSeqList]) => {
const index = roomSeqList.findIndex(
(roomSeq, i) => roomSeq === req.roomSeq
);
if (index > -1) {
return this.roomProtocolService.info(req).pipe(
map(res => {
switch (res.SSVC_TYPE) {
case SSVC_TYPE_ROOM_INFO_ROOM:
roomInfo = (res as InfoData).roomInfo;
break;
case SSVC_TYPE_ROOM_INFO_USER:
userInfoShortList.push(...(res as UserShortData).userInfos);
break;
case SSVC_TYPE_ROOM_INFO_USER2:
userInfoList.push(...(res as UserData).userInfos);
break;
case SSVC_TYPE_ROOM_INFO_RES:
this.store.dispatch(
refreshRoomSuccess({
roomInfo,
userInfoShortList,
userInfoList
})
);
break;
}
}),
catchError(error => of(refreshRoomFailure({ error })))
);
} else {
return of();
}
})
);
},
{ dispatch: false }
);
// 대화상대 초대 성공 후 처리.
inviteSuccess$ = createEffect(() =>