bugfix ::

1. 강제퇴장시 state 에서 remove 하지 않고 isJoinRoom 플래그만 변경하도록 수정.
2. 대화상대 초대시 방정보를 갱신하도록 수정. >> INVITE_NOTI 에 초대자 정보가 유입되지 않음.
This commit is contained in:
leejinho 2020-02-04 16:34:27 +09:00
parent b58e52325d
commit 4569202230
8 changed files with 139 additions and 57 deletions

View File

@ -1286,12 +1286,6 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
(message as Info<string>).sentMessage (message as Info<string>).sentMessage
) )
) { ) {
this.snackBarService.open(
this.translateService.instant(
'common.clipboard.results.copied'
),
'확인'
);
this.snackBarService.open( this.snackBarService.open(
this.translateService.instant( this.translateService.instant(
'common.clipboard.results.copied' 'common.clipboard.results.copied'

View File

@ -474,6 +474,20 @@ export class AppNotificationService {
); );
} }
break; break;
case SSVC_TYPE_ROOM_INVITE_NOTI:
{
const noti = notiOrRes as InviteNotification;
this.logger.debug(
'Notification::roomProtocolService::InviteNotification',
noti
);
this.store.dispatch(
RoomStore.inviteNotification({
noti
})
);
}
break;
case SSVC_TYPE_ROOM_UPD_RES: case SSVC_TYPE_ROOM_UPD_RES:
{ {
const noti = notiOrRes as RoomUpdateNotification; const noti = notiOrRes as RoomUpdateNotification;
@ -496,20 +510,6 @@ export class AppNotificationService {
); );
} }
break; break;
case SSVC_TYPE_ROOM_INVITE_NOTI:
{
const noti = notiOrRes as InviteNotification;
this.logger.debug(
'Notification::roomProtocolService::InviteNotification',
noti
);
this.store.dispatch(
RoomStore.inviteNotification({
noti
})
);
}
break;
case SSVC_TYPE_ROOM_EXIT_RES: case SSVC_TYPE_ROOM_EXIT_RES:
case SSVC_TYPE_ROOM_EXIT_NOTI: case SSVC_TYPE_ROOM_EXIT_NOTI:
{ {
@ -528,7 +528,8 @@ export class AppNotificationService {
} else { } else {
this.store.dispatch( this.store.dispatch(
RoomStore.exitNotificationOthers({ RoomStore.exitNotificationOthers({
noti roomSeq: noti.roomSeq,
trgtUser: [noti.SENDER_SEQ]
}) })
); );
@ -560,15 +561,31 @@ export class AppNotificationService {
break; break;
case SSVC_TYPE_ROOM_EXIT_FORCING_NOTI: case SSVC_TYPE_ROOM_EXIT_FORCING_NOTI:
{ {
// 내가 강퇴 됨.
const noti = notiOrRes as ExitForcingNotification; const noti = notiOrRes as ExitForcingNotification;
this.logger.debug( this.logger.debug(
'Notification::roomProtocolService::ExitForcingNotification NOTI', 'Notification::roomProtocolService::ExitForcingNotification NOTI',
noti noti
); );
if (noti.userSeqs.indexOf(loginResInfo.userSeq) >= 0) {
this.store.dispatch(
RoomStore.exitForcingNotification({
noti
})
);
}
this.store.dispatch( this.store.dispatch(
RoomStore.exitForcingNotification({ RoomStore.exitNotificationOthers({
noti roomSeq: noti.roomSeq,
trgtUser: noti.userSeqs
})
);
this.store.dispatch(
SyncStore.clearRoomUsers({
roomSeq: noti.roomSeq,
userSeqs: noti.userSeqs
}) })
); );
} }

View File

@ -56,9 +56,12 @@ export const exitNotification = createAction(
'[Messenger::Room] Exit Notification', '[Messenger::Room] Exit Notification',
props<{ noti: ExitNotification }>() props<{ noti: ExitNotification }>()
); );
/**
* isJoinRoom flag false .
*/
export const exitNotificationOthers = createAction( export const exitNotificationOthers = createAction(
'[Messenger::Room] Exit Notification By Others', '[Messenger::Room] Exit Notification By Others',
props<{ noti: ExitNotification }>() props<{ roomSeq: string; trgtUser: number[] }>()
); );
export const exitForcing = createAction( export const exitForcing = createAction(

View File

@ -310,8 +310,25 @@ export class Effects {
() => { () => {
return this.actions$.pipe( return this.actions$.pipe(
ofType(inviteNotification), ofType(inviteNotification),
map(action => action.noti), withLatestFrom(
tap(noti => {}) this.store.pipe(
select((state: any) => state.messenger.room.roomInfo as RoomInfo)
)
),
tap(([action, roomInfo]) => {
if (!!roomInfo && roomInfo.roomSeq === action.noti.roomSeq) {
const loginInfo = this.sessionStorageService.get<LoginInfo>(
KEY_LOGIN_INFO
);
this.store.dispatch(
info({
roomSeq: action.noti.roomSeq,
isDetail: true,
localeCode: loginInfo.localeCode
})
);
}
})
); );
}, },
{ dispatch: false } { dispatch: false }
@ -354,13 +371,11 @@ export class Effects {
tap(([action, roomInfo]) => { tap(([action, roomInfo]) => {
if ( if (
!!roomInfo && !!roomInfo &&
roomInfo.roomSeq === action.noti.roomSeq && roomInfo.roomSeq === action.roomSeq &&
!!action.noti && !!action.trgtUser &&
!!action.noti.SENDER_SEQ action.trgtUser.length > 0
) { ) {
this.store.dispatch( this.store.dispatch(clearRoomUser({ userSeqs: action.trgtUser }));
clearRoomUser({ userSeqs: [action.noti.SENDER_SEQ] })
);
} }
}) })
); );

View File

@ -10,7 +10,7 @@ import {
import * as AuthenticationStore from '@app/store/account/authentication'; import * as AuthenticationStore from '@app/store/account/authentication';
import * as ChatStore from '@app/store/messenger/chat'; import * as ChatStore from '@app/store/messenger/chat';
import { UserInfo } from '@ucap-webmessenger/protocol-room'; import { UserInfo, UserInfoShort } from '@ucap-webmessenger/protocol-room';
export const reducer = createReducer( export const reducer = createReducer(
initialState, initialState,
@ -28,14 +28,45 @@ export const reducer = createReducer(
}), }),
on(clearRoomUser, (state, action) => { on(clearRoomUser, (state, action) => {
const tmpUserInfoList: UserInfo[] = [];
const tmpUserInfoShortList: UserInfoShort[] = [];
action.userSeqs.forEach(userSeq => {
const userInfo: UserInfo = {
...state.userInfoList.entities[userSeq]
};
if (!!userInfo && !!userInfo.seq) {
tmpUserInfoList.push({
...userInfo,
isJoinRoom: false
});
}
const userInfoShort: UserInfoShort = {
...state.userInfoShortList.entities[userSeq]
};
if (!!userInfoShort && !!userInfoShort.seq) {
tmpUserInfoShortList.push({
...userInfoShort,
isJoinRoom: false
});
}
});
return { return {
...state, ...state,
userInfoList: adapterUserInfo.removeMany(action.userSeqs, { userInfoList:
...state.userInfoList tmpUserInfoList.length > 0
}), ? adapterUserInfo.upsertMany(tmpUserInfoList, {
userInfoShortList: adapterUserInfoShort.removeMany(action.userSeqs, { ...state.userInfoList
...state.userInfoShortList })
}) : state.userInfoList,
userInfoShortList:
tmpUserInfoShortList.length > 0
? adapterUserInfoShort.upsertMany(tmpUserInfoShortList, {
...state.userInfoShortList
})
: state.userInfoShortList
}; };
}), }),

View File

@ -264,7 +264,7 @@ export const delGroupFailure = createAction(
props<{ error: any }>() props<{ error: any }>()
); );
/** 방 인원 클리어 */ /** Sync 되어 있는 방의 방인원의 isJoinRoom flag 를 false 로 변경. */
export const clearRoomUsers = createAction( export const clearRoomUsers = createAction(
'[Messenger::Sync] Clear room users.', '[Messenger::Sync] Clear room users.',
props<{ roomSeq: string; userSeqs: number[] }>() props<{ roomSeq: string; userSeqs: number[] }>()

View File

@ -342,6 +342,10 @@ export class Effects {
let roomSeq = null; let roomSeq = null;
for (const key in roomUsers) { for (const key in roomUsers) {
if (key === undefined) {
continue;
}
if (roomUsers.hasOwnProperty(key)) { if (roomUsers.hasOwnProperty(key)) {
const element = roomUsers[key]; const element = roomUsers[key];
if (userSeqList.length === element.userInfos.length) { if (userSeqList.length === element.userInfos.length) {
@ -371,6 +375,10 @@ export class Effects {
} }
for (const key in roomUserShorts) { for (const key in roomUserShorts) {
if (key === undefined) {
continue;
}
if (roomUserShorts.hasOwnProperty(key)) { if (roomUserShorts.hasOwnProperty(key)) {
const element = roomUserShorts[key]; const element = roomUserShorts[key];
if (userSeqList.length === element.userInfos.length) { if (userSeqList.length === element.userInfos.length) {

View File

@ -103,35 +103,45 @@ export const reducer = createReducer(
}), }),
on(clearRoomUsers, (state, action) => { on(clearRoomUsers, (state, action) => {
let roomUserList: RoomUserDetailData = { const roomUserList: RoomUserDetailData = {
...state.roomUser.entities[action.roomSeq] ...state.roomUser.entities[action.roomSeq]
}; };
let trgtRoomUserList: RoomUserDetailData;
if ( if (
!!roomUserList && !!roomUserList &&
!!roomUserList.userInfos && !!roomUserList.userInfos &&
roomUserList.userInfos.length > 0 roomUserList.userInfos.length > 0
) { ) {
const userInfos = roomUserList.userInfos.filter( const userInfos = roomUserList.userInfos.map(userInfo => {
userInfo => action.userSeqs.indexOf(userInfo.seq) < 0 if (action.userSeqs.indexOf(userInfo.seq) >= 0) {
); return { ...userInfo, isJoinRoom: false };
roomUserList = { } else {
return userInfo;
}
});
trgtRoomUserList = {
...roomUserList, ...roomUserList,
userInfos userInfos
}; };
} }
let roomUserShortList: RoomUserData = { const roomUserShortList: RoomUserData = {
...state.roomUserShort.entities[action.roomSeq] ...state.roomUserShort.entities[action.roomSeq]
}; };
let trgtRoomUserShortList: RoomUserData;
if ( if (
!!roomUserShortList && !!roomUserShortList &&
!!roomUserShortList.userInfos && !!roomUserShortList.userInfos &&
roomUserShortList.userInfos.length > 0 roomUserShortList.userInfos.length > 0
) { ) {
const userInfos = roomUserShortList.userInfos.filter( const userInfos = roomUserShortList.userInfos.map(userInfo => {
userInfo => action.userSeqs.indexOf(userInfo.seq) < 0 if (action.userSeqs.indexOf(userInfo.seq) >= 0) {
); return { ...userInfo, isJoinRoom: false };
roomUserShortList = { } else {
return userInfo;
}
});
trgtRoomUserShortList = {
...roomUserShortList, ...roomUserShortList,
userInfos userInfos
}; };
@ -139,12 +149,16 @@ export const reducer = createReducer(
return { return {
...state, ...state,
roomUser: adapterRoomUser.upsertOne(roomUserList, { roomUser: !!trgtRoomUserList
...state.roomUser ? adapterRoomUser.upsertOne(trgtRoomUserList, {
}), ...state.roomUser
roomUserShort: adapterRoomUserShort.upsertOne(roomUserShortList, { })
...state.roomUserShort : state.roomUser,
}) roomUserShort: !!trgtRoomUserShortList
? adapterRoomUserShort.upsertOne(trgtRoomUserShortList, {
...state.roomUserShort
})
: state.roomUserShort
}; };
}), }),