Merge branch 'master' of http://10.81.13.221:6990/Web/next-ucap-messenger
This commit is contained in:
commit
af18ab5c21
|
@ -102,7 +102,7 @@ body.theme-pink-dark {
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Define the primary, accent and warn palettes
|
// Define the primary, accent and warn palettes
|
||||||
$pink-light-theme-primary-palette: mat-palette($lg-red);
|
$pink-light-theme-primary-palette: mat-palette($mat-pink);
|
||||||
$pink-light-theme-accent-palette: mat-palette($mat-pink);
|
$pink-light-theme-accent-palette: mat-palette($mat-pink);
|
||||||
$pink-light-theme-warn-palette: mat-palette($mat-red);
|
$pink-light-theme-warn-palette: mat-palette($mat-red);
|
||||||
|
|
||||||
|
|
|
@ -306,16 +306,32 @@ export class GroupComponent implements OnInit, OnDestroy {
|
||||||
case 'EDIT_MEMBER':
|
case 'EDIT_MEMBER':
|
||||||
{
|
{
|
||||||
const result = await this.dialogService.open<
|
const result = await this.dialogService.open<
|
||||||
EditGroupMemberDialogComponent,
|
CreateChatDialogComponent,
|
||||||
EditGroupMemberDialogData,
|
CreateChatDialogData,
|
||||||
EditGroupMemberDialogResult
|
CreateChatDialogResult
|
||||||
>(EditGroupMemberDialogComponent, {
|
>(CreateChatDialogComponent, {
|
||||||
width: '220px',
|
width: '600px',
|
||||||
|
height: '500px',
|
||||||
data: {
|
data: {
|
||||||
title: 'Logout',
|
type: UserSelectDialogType.EditMember,
|
||||||
message: 'Logout ?'
|
title: 'Group Member Edit',
|
||||||
|
group
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!!result && !!result.choice && result.choice) {
|
||||||
|
if (!!result.oldGroup) {
|
||||||
|
const userSeqs: number[] = [];
|
||||||
|
result.selectedUserList.map(user => userSeqs.push(user.seq));
|
||||||
|
|
||||||
|
this.store.dispatch(
|
||||||
|
SyncStore.updateGroupMember({
|
||||||
|
oldGroup: group,
|
||||||
|
trgtUserSeq: userSeqs
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'DELETE':
|
case 'DELETE':
|
||||||
|
|
|
@ -37,12 +37,15 @@ import {
|
||||||
export interface CreateChatDialogData {
|
export interface CreateChatDialogData {
|
||||||
type?: string;
|
type?: string;
|
||||||
title: string;
|
title: string;
|
||||||
|
/** CASE :: EditMember */
|
||||||
|
group?: GroupDetailData;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreateChatDialogResult {
|
export interface CreateChatDialogResult {
|
||||||
choice: boolean;
|
choice: boolean;
|
||||||
selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[];
|
selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[];
|
||||||
groupName?: string;
|
groupName?: string;
|
||||||
|
oldGroup?: GroupDetailData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -119,14 +122,23 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
|
||||||
buddyList: UserInfo[];
|
buddyList: UserInfo[];
|
||||||
}[] = [];
|
}[] = [];
|
||||||
for (const group of groupList) {
|
for (const group of groupList) {
|
||||||
groupBuddyList.push({
|
const data = {
|
||||||
group,
|
group,
|
||||||
buddyList: buddyList.filter(buddy => {
|
buddyList: buddyList.filter(buddy => {
|
||||||
return group.userSeqs.indexOf(buddy.seq) > -1;
|
return group.userSeqs.indexOf(buddy.seq) > -1;
|
||||||
})
|
})
|
||||||
});
|
};
|
||||||
}
|
groupBuddyList.push(data);
|
||||||
|
|
||||||
|
/** 그룹 멤버 변경일 경우 그룹원을 기본 셀렉트 한다. */
|
||||||
|
if (
|
||||||
|
this.data.type === UserSelectDialogType.EditMember &&
|
||||||
|
!!this.data.group &&
|
||||||
|
this.data.group.seq === group.seq
|
||||||
|
) {
|
||||||
|
this.selectedUserList = [...data.buddyList];
|
||||||
|
}
|
||||||
|
}
|
||||||
return groupBuddyList;
|
return groupBuddyList;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -280,7 +292,11 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
|
||||||
groupName:
|
groupName:
|
||||||
this.data.type === UserSelectDialogType.NewGroup
|
this.data.type === UserSelectDialogType.NewGroup
|
||||||
? this.inputForm.get('groupName').value
|
? this.inputForm.get('groupName').value
|
||||||
: ''
|
: '',
|
||||||
|
oldGroup:
|
||||||
|
this.data.type === UserSelectDialogType.EditMember
|
||||||
|
? this.data.group
|
||||||
|
: undefined
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,12 @@ export const reducer = createReducer(
|
||||||
on(bulkInfoSuccess, (state, action) => {
|
on(bulkInfoSuccess, (state, action) => {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
statusBulkInfo: adapterStatusBulkInfo.addAll(action.statusBulkInfoList, {
|
statusBulkInfo: adapterStatusBulkInfo.upsertMany(
|
||||||
...state.statusBulkInfo
|
action.statusBulkInfoList,
|
||||||
})
|
{
|
||||||
|
...state.statusBulkInfo
|
||||||
|
}
|
||||||
|
)
|
||||||
} as State;
|
} as State;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,11 @@ import {
|
||||||
} from '@ucap-webmessenger/protocol-group';
|
} from '@ucap-webmessenger/protocol-group';
|
||||||
import {
|
import {
|
||||||
AddRequest as BuddyAddRequest,
|
AddRequest as BuddyAddRequest,
|
||||||
AddResponse as BuddyAddResponse
|
AddResponse as BuddyAddResponse,
|
||||||
|
DelRequest as BuddyDelRequest,
|
||||||
|
DelResponse as BuddyDelResponse,
|
||||||
|
UpdateRequest as BuddyUpdateRequest,
|
||||||
|
UpdateResponse as BuddyUpdateResponse
|
||||||
} from '@ucap-webmessenger/protocol-buddy';
|
} from '@ucap-webmessenger/protocol-buddy';
|
||||||
|
|
||||||
export const buddy2 = createAction(
|
export const buddy2 = createAction(
|
||||||
|
@ -137,32 +141,70 @@ export const createGroupAndBuddy = createAction(
|
||||||
trgtUserSeq: number[];
|
trgtUserSeq: number[];
|
||||||
}>()
|
}>()
|
||||||
);
|
);
|
||||||
|
|
||||||
export const createGroupAndBuddySuccess = createAction(
|
export const createGroupAndBuddySuccess = createAction(
|
||||||
'[Messenger::Sync] Group & Buddy Create Success',
|
'[Messenger::Sync] Group & Buddy Create Success',
|
||||||
props<GroupAddResponse>()
|
props<GroupAddResponse>()
|
||||||
);
|
);
|
||||||
|
|
||||||
export const createGroupAndBuddyFailure = createAction(
|
export const createGroupAndBuddyFailure = createAction(
|
||||||
'[Messenger::Sync] Group & Buddy Create Failure',
|
'[Messenger::Sync] Group & Buddy Create Failure',
|
||||||
props<{ error: any }>()
|
props<{ error: any }>()
|
||||||
);
|
);
|
||||||
|
/** 그룹원 수정 */
|
||||||
|
export const updateGroupMember = createAction(
|
||||||
|
'[Messenger::Sync] Update Group Member',
|
||||||
|
props<{
|
||||||
|
oldGroup: GroupDetailData;
|
||||||
|
trgtUserSeq: number[];
|
||||||
|
}>()
|
||||||
|
);
|
||||||
|
export const updateGroupMemberSuccess = createAction(
|
||||||
|
'[Messenger::Sync] Update Group Member Success',
|
||||||
|
props<GroupAddResponse>()
|
||||||
|
);
|
||||||
|
export const updateGroupMemberFailure = createAction(
|
||||||
|
'[Messenger::Sync] Update Group Member Failure',
|
||||||
|
props<{ error: any }>()
|
||||||
|
);
|
||||||
|
|
||||||
/** 동료 추가 */
|
/** 동료 추가 */
|
||||||
export const addBuddy = createAction(
|
export const addBuddy = createAction(
|
||||||
'[Messenger::Sync] Buddy Add',
|
'[Messenger::Sync] Buddy Add',
|
||||||
props<BuddyAddRequest>()
|
props<BuddyAddRequest>()
|
||||||
);
|
);
|
||||||
|
|
||||||
export const addBuddySuccess = createAction(
|
export const addBuddySuccess = createAction(
|
||||||
'[Messenger::Sync] Buddy Add Success',
|
'[Messenger::Sync] Buddy Add Success',
|
||||||
props<BuddyAddResponse>()
|
props<BuddyAddResponse>()
|
||||||
);
|
);
|
||||||
|
|
||||||
export const addBuddyFailure = createAction(
|
export const addBuddyFailure = createAction(
|
||||||
'[Messenger::Sync] Buddy Add Failure',
|
'[Messenger::Sync] Buddy Add Failure',
|
||||||
props<{ error: any }>()
|
props<{ error: any }>()
|
||||||
);
|
);
|
||||||
|
/** 동료 삭제 */
|
||||||
|
export const delBuddy = createAction(
|
||||||
|
'[Messenger::Sync] Buddy Del',
|
||||||
|
props<BuddyDelRequest>()
|
||||||
|
);
|
||||||
|
export const delBuddySuccess = createAction(
|
||||||
|
'[Messenger::Sync] Buddy Del Success',
|
||||||
|
props<BuddyDelResponse>()
|
||||||
|
);
|
||||||
|
export const delBuddyFailure = createAction(
|
||||||
|
'[Messenger::Sync] Buddy Del Failure',
|
||||||
|
props<{ error: any }>()
|
||||||
|
);
|
||||||
|
/** 동료 변경(즐겨찾기) */
|
||||||
|
export const updateBuddy = createAction(
|
||||||
|
'[Messenger::Sync] Buddy Update',
|
||||||
|
props<BuddyUpdateRequest>()
|
||||||
|
);
|
||||||
|
export const updateBuddySuccess = createAction(
|
||||||
|
'[Messenger::Sync] Buddy Update Success',
|
||||||
|
props<BuddyUpdateResponse>()
|
||||||
|
);
|
||||||
|
export const updateBuddyFailure = createAction(
|
||||||
|
'[Messenger::Sync] Buddy Update Failure',
|
||||||
|
props<{ error: any }>()
|
||||||
|
);
|
||||||
|
|
||||||
/** 그룹원 업데이트 */
|
/** 그룹원 업데이트 */
|
||||||
export const updateGroup = createAction(
|
export const updateGroup = createAction(
|
||||||
|
|
|
@ -36,8 +36,13 @@ import {
|
||||||
createGroupAndBuddy,
|
createGroupAndBuddy,
|
||||||
addBuddy,
|
addBuddy,
|
||||||
addBuddyFailure,
|
addBuddyFailure,
|
||||||
|
delBuddy,
|
||||||
|
delBuddyFailure,
|
||||||
updateGroup,
|
updateGroup,
|
||||||
updateGroupFailure
|
updateGroupFailure,
|
||||||
|
updateGroupMember,
|
||||||
|
updateBuddy,
|
||||||
|
delBuddySuccess
|
||||||
} from './actions';
|
} from './actions';
|
||||||
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
|
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
|
||||||
import { LoginInfo, KEY_LOGIN_INFO } from '@app/types';
|
import { LoginInfo, KEY_LOGIN_INFO } from '@app/types';
|
||||||
|
@ -82,7 +87,8 @@ import {
|
||||||
} from '@ucap-webmessenger/protocol-group';
|
} from '@ucap-webmessenger/protocol-group';
|
||||||
import {
|
import {
|
||||||
BuddyProtocolService,
|
BuddyProtocolService,
|
||||||
AddResponse as BuddyAddResponse
|
AddResponse as BuddyAddResponse,
|
||||||
|
DelResponse as BuddyDelResponse
|
||||||
} from '@ucap-webmessenger/protocol-buddy';
|
} from '@ucap-webmessenger/protocol-buddy';
|
||||||
|
|
||||||
import * as ChatStore from '@app/store/messenger/chat';
|
import * as ChatStore from '@app/store/messenger/chat';
|
||||||
|
@ -456,7 +462,7 @@ export class Effects {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (addBuddyList.length > 0) {
|
if (addBuddyList.length > 0) {
|
||||||
this.logger.debug('add : ', addBuddyList);
|
this.logger.debug('addBuddyList : ', addBuddyList);
|
||||||
this.store.dispatch(addBuddy({ userSeqs: addBuddyList }));
|
this.store.dispatch(addBuddy({ userSeqs: addBuddyList }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,6 +483,91 @@ export class Effects {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
updateGroupMember$ = createEffect(
|
||||||
|
() => {
|
||||||
|
return this.actions$.pipe(
|
||||||
|
ofType(updateGroupMember),
|
||||||
|
withLatestFrom(
|
||||||
|
this.store.pipe(
|
||||||
|
select(
|
||||||
|
(state: any) =>
|
||||||
|
state.messenger.sync.buddy2.entities as Dictionary<UserInfo>
|
||||||
|
)
|
||||||
|
),
|
||||||
|
this.store.pipe(
|
||||||
|
select(
|
||||||
|
(state: any) =>
|
||||||
|
state.messenger.sync.group2.entities as Dictionary<
|
||||||
|
GroupDetailData
|
||||||
|
>
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
tap(([action, buddyList, groupList]) => {
|
||||||
|
// Add Buddy
|
||||||
|
const addBuddyList: number[] = [];
|
||||||
|
action.trgtUserSeq.forEach(item => {
|
||||||
|
if (!buddyList[item]) {
|
||||||
|
addBuddyList.push(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Del Buddy
|
||||||
|
let delBuddyInGroup: number[] = action.oldGroup.userSeqs.filter(
|
||||||
|
v => action.trgtUserSeq.indexOf(v) < 0
|
||||||
|
);
|
||||||
|
// tslint:disable-next-line: no-shadowed-variable
|
||||||
|
delBuddyInGroup = delBuddyInGroup.filter(delBuddy => {
|
||||||
|
let exist = false;
|
||||||
|
// tslint:disable-next-line: forin
|
||||||
|
for (const key in groupList) {
|
||||||
|
const group: GroupDetailData = groupList[key];
|
||||||
|
if (
|
||||||
|
group.seq !== action.oldGroup.seq &&
|
||||||
|
group.userSeqs.filter(v => v === delBuddy).length > 0
|
||||||
|
) {
|
||||||
|
exist = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return !exist;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (addBuddyList.length > 0) {
|
||||||
|
this.logger.debug('addBuddyList : ', addBuddyList);
|
||||||
|
this.store.dispatch(addBuddy({ userSeqs: addBuddyList }));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (delBuddyInGroup.length > 0) {
|
||||||
|
this.logger.debug('delBuddyInGroup', delBuddyInGroup);
|
||||||
|
// 즐겨찾기 해제.
|
||||||
|
delBuddyInGroup.forEach(buddySeq => {
|
||||||
|
this.buddyProtocolService
|
||||||
|
.update({
|
||||||
|
seq: buddySeq,
|
||||||
|
isFavorit: false
|
||||||
|
})
|
||||||
|
.pipe(catchError(error => of(delBuddyFailure({ error }))));
|
||||||
|
});
|
||||||
|
|
||||||
|
// 동료 삭제
|
||||||
|
this.store.dispatch(delBuddy({ userSeqs: delBuddyInGroup }));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.logger.debug('group member update', action.trgtUserSeq);
|
||||||
|
this.store.dispatch(
|
||||||
|
updateGroup({
|
||||||
|
groupSeq: action.oldGroup.seq,
|
||||||
|
groupName: action.oldGroup.name,
|
||||||
|
userSeqs: action.trgtUserSeq
|
||||||
|
})
|
||||||
|
);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
},
|
||||||
|
{ dispatch: false }
|
||||||
|
);
|
||||||
|
|
||||||
addBuddy$ = createEffect(() =>
|
addBuddy$ = createEffect(() =>
|
||||||
this.actions$.pipe(
|
this.actions$.pipe(
|
||||||
ofType(addBuddy),
|
ofType(addBuddy),
|
||||||
|
@ -498,6 +589,30 @@ export class Effects {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
delBuddy$ = createEffect(() =>
|
||||||
|
this.actions$.pipe(
|
||||||
|
ofType(delBuddy),
|
||||||
|
withLatestFrom(
|
||||||
|
this.store.pipe(
|
||||||
|
select((state: any) => state.messenger.sync.buddy2.syncDate as string)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
exhaustMap(([req, syncDate]) =>
|
||||||
|
this.buddyProtocolService.del(req).pipe(
|
||||||
|
map((res: BuddyDelResponse) => {
|
||||||
|
return delBuddySuccess(res);
|
||||||
|
}),
|
||||||
|
// map((res: BuddyDelResponse) => {
|
||||||
|
// return buddy2({
|
||||||
|
// syncDate
|
||||||
|
// });
|
||||||
|
// }),
|
||||||
|
catchError(error => of(delBuddyFailure({ error })))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
updateGroup$ = createEffect(() =>
|
updateGroup$ = createEffect(() =>
|
||||||
this.actions$.pipe(
|
this.actions$.pipe(
|
||||||
ofType(updateGroup),
|
ofType(updateGroup),
|
||||||
|
|
|
@ -15,7 +15,8 @@ import {
|
||||||
refreshRoomSuccess,
|
refreshRoomSuccess,
|
||||||
updateUnreadCount,
|
updateUnreadCount,
|
||||||
createGroupSuccess,
|
createGroupSuccess,
|
||||||
addBuddySuccess
|
addBuddySuccess,
|
||||||
|
delBuddySuccess
|
||||||
} from './actions';
|
} from './actions';
|
||||||
import {
|
import {
|
||||||
RoomUserDetailData,
|
RoomUserDetailData,
|
||||||
|
@ -202,5 +203,14 @@ export const reducer = createReducer(
|
||||||
...state.group2
|
...state.group2
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
}),
|
||||||
|
|
||||||
|
on(delBuddySuccess, (state, action) => {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
buddy2: adapterBuddy2.removeMany(action.userSeqs, {
|
||||||
|
...state.buddy2
|
||||||
|
})
|
||||||
|
};
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
@ -6,5 +6,5 @@ export enum UserSelectDialogType {
|
||||||
/** 대화 전달 */
|
/** 대화 전달 */
|
||||||
MessageForward = 'MESSAGE_FORWARD',
|
MessageForward = 'MESSAGE_FORWARD',
|
||||||
/** 그룹멤버 변경 */
|
/** 그룹멤버 변경 */
|
||||||
GroupMemberUpdate = 'GROUP_MEMBER_UPDATE'
|
EditMember = 'EDIT_MEMBER'
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user