기능추기 :: 대화 상대 추가
This commit is contained in:
parent
610ca140a6
commit
c7a7f6ca23
|
@ -576,9 +576,6 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
switch (menuType) {
|
||||
case 'ADD_MEMBER':
|
||||
{
|
||||
console.log(this.roomInfo);
|
||||
console.log(this.userInfoList);
|
||||
|
||||
const result = await this.dialogService.open<
|
||||
CreateChatDialogComponent,
|
||||
CreateChatDialogData,
|
||||
|
@ -587,39 +584,36 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
width: '600px',
|
||||
data: {
|
||||
type: UserSelectDialogType.EditChatMember,
|
||||
title: 'Edit Chat Member'
|
||||
// ,
|
||||
// curRoomUser: this.userInfoList
|
||||
title: 'Edit Chat Member',
|
||||
curRoomUser: this.userInfoList.filter(
|
||||
user => user.seq !== this.loginRes.userSeq
|
||||
)
|
||||
}
|
||||
});
|
||||
|
||||
if (!!result && !!result.choice && result.choice) {
|
||||
const userSeqs: number[] = [];
|
||||
let roomSeq = '';
|
||||
if (
|
||||
!!result.selectedUserList &&
|
||||
result.selectedUserList.length > 0
|
||||
) {
|
||||
result.selectedUserList.map(user => userSeqs.push(user.seq));
|
||||
result.selectedUserList.map(user => {
|
||||
userSeqs.push(user.seq);
|
||||
});
|
||||
}
|
||||
|
||||
if (!!result.selectedRoom) {
|
||||
roomSeq = result.selectedRoom.roomSeq;
|
||||
}
|
||||
if (userSeqs.length > 0) {
|
||||
// include me
|
||||
userSeqs.push(this.loginRes.userSeq);
|
||||
|
||||
if (userSeqs.length > 0 || roomSeq.trim().length > 0) {
|
||||
// this.store.dispatch(
|
||||
// EventStore.forward({
|
||||
// senderSeq: this.loginRes.userSeq,
|
||||
// req: {
|
||||
// roomSeq: '-999',
|
||||
// eventType: message.type,
|
||||
// sentMessage: message.sentMessage
|
||||
// },
|
||||
// trgtUserSeqs: userSeqs,
|
||||
// trgtRoomSeq: roomSeq
|
||||
// })
|
||||
// );
|
||||
this.store.dispatch(
|
||||
RoomStore.inviteOrOpen({
|
||||
req: {
|
||||
divCd: 'Invite',
|
||||
userSeqs
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,12 @@
|
|||
<div *ngIf="searchProcessing">
|
||||
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
|
||||
</div>
|
||||
<div class="result-num">검색결과 <span class="text-accent-color">({{ searchUserInfos.length }}명)</span></div>
|
||||
<div class="result-num">
|
||||
검색결과
|
||||
<span class="text-accent-color"
|
||||
>({{ searchUserInfos.length }}명)</span
|
||||
>
|
||||
</div>
|
||||
<ucap-profile-user-list-item
|
||||
*ngFor="let userInfo of searchUserInfos"
|
||||
[userInfo]="userInfo"
|
||||
|
@ -141,15 +146,17 @@
|
|||
<mat-chip-list aria-label="User selection">
|
||||
<mat-chip
|
||||
*ngFor="let userInfo of selectedUserList"
|
||||
color="primary"
|
||||
selected
|
||||
[selected]="getChipsRemoveYn(userInfo)"
|
||||
(removed)="onClickDeleteUser(userInfo)"
|
||||
>
|
||||
{{ userInfo.name }}
|
||||
<mat-icon matChipRemove>clear</mat-icon>
|
||||
<mat-icon matChipRemove *ngIf="getChipsRemoveYn(userInfo)"
|
||||
>clear</mat-icon
|
||||
>
|
||||
</mat-chip>
|
||||
</mat-chip-list>
|
||||
</div>
|
||||
<span>{{ selectedUserList.length }}명</span>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
<mat-card-actions class="button-farm flex-row">
|
||||
|
|
|
@ -57,12 +57,22 @@ export interface CreateChatDialogData {
|
|||
/** CASE :: EventForward */
|
||||
ignoreRoom?: RoomInfo[];
|
||||
/** CASE :: EditCharMember */
|
||||
curRoomUser?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[];
|
||||
curRoomUser?: (
|
||||
| UserInfo
|
||||
| UserInfoSS
|
||||
| UserInfoF
|
||||
| UserInfoDN
|
||||
| RoomUserInfo)[];
|
||||
}
|
||||
|
||||
export interface CreateChatDialogResult {
|
||||
choice: boolean;
|
||||
selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[];
|
||||
selectedUserList?: (
|
||||
| UserInfo
|
||||
| UserInfoSS
|
||||
| UserInfoF
|
||||
| UserInfoDN
|
||||
| RoomUserInfo)[];
|
||||
selectedRoom?: RoomInfo;
|
||||
groupName?: string;
|
||||
oldGroup?: GroupDetailData;
|
||||
|
@ -117,7 +127,12 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
|
|||
roomSubscription: Subscription;
|
||||
|
||||
// 수집 데이터
|
||||
selectedUserList: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = [];
|
||||
selectedUserList: (
|
||||
| UserInfo
|
||||
| UserInfoSS
|
||||
| UserInfoF
|
||||
| UserInfoDN
|
||||
| RoomUserInfo)[] = [];
|
||||
isShowSelectedUserList = true;
|
||||
selectedRoom: RoomInfo;
|
||||
|
||||
|
@ -208,6 +223,10 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
|
|||
this.inputForm = this.formBuilder.group({
|
||||
groupName: ['', [Validators.required]]
|
||||
});
|
||||
|
||||
if (this.data.type === UserSelectDialogType.EditChatMember) {
|
||||
this.selectedUserList = this.data.curRoomUser;
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
|
@ -239,6 +258,21 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
}
|
||||
|
||||
getChipsRemoveYn(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) {
|
||||
if (
|
||||
this.data.type === UserSelectDialogType.EditChatMember &&
|
||||
!!this.data.curRoomUser &&
|
||||
this.data.curRoomUser.length > 0
|
||||
) {
|
||||
return !(
|
||||
this.data.curRoomUser.filter(user => user.seq === userInfo.seq).length >
|
||||
0
|
||||
);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
onSelectedTabChange(tabChangeEvent: MatTabChangeEvent): void {
|
||||
if (tabChangeEvent.index === 2) {
|
||||
this.selectedUserList = [];
|
||||
|
|
|
@ -15,7 +15,9 @@ import {
|
|||
ExitRequest,
|
||||
ExitResponse,
|
||||
Open3Request,
|
||||
Open3Response
|
||||
Open3Response,
|
||||
InviteRequest,
|
||||
InviteResponse
|
||||
} from '@ucap-webmessenger/protocol-room';
|
||||
import { ReadNotification } from '@ucap-webmessenger/protocol-event';
|
||||
|
||||
|
@ -115,6 +117,19 @@ export const openTimerFailure = createAction(
|
|||
props<{ error: any }>()
|
||||
);
|
||||
|
||||
export const inviteOrOpen = createAction(
|
||||
'[Messenger::Room] Invite or Open',
|
||||
props<{ req: OpenRequest }>()
|
||||
);
|
||||
export const inviteSuccess = createAction(
|
||||
'[Messenger::Room] Invite Success',
|
||||
props<InviteResponse>()
|
||||
);
|
||||
export const inviteFailure = createAction(
|
||||
'[Messenger::Room] Invite Failure',
|
||||
props<{ error: any }>()
|
||||
);
|
||||
|
||||
export const exit = createAction(
|
||||
'[Messenger::Room] Exit',
|
||||
props<ExitRequest>()
|
||||
|
|
|
@ -30,7 +30,9 @@ import {
|
|||
UpdateResponse,
|
||||
OpenResponse,
|
||||
ExitResponse,
|
||||
Open3Response
|
||||
Open3Response,
|
||||
RoomType,
|
||||
InviteResponse
|
||||
} from '@ucap-webmessenger/protocol-room';
|
||||
|
||||
import * as ChatStore from '@app/store/messenger/chat';
|
||||
|
@ -55,7 +57,10 @@ import {
|
|||
exitFailure,
|
||||
openTimer,
|
||||
openTimerSuccess,
|
||||
openTimerFailure
|
||||
openTimerFailure,
|
||||
inviteOrOpen,
|
||||
inviteSuccess,
|
||||
inviteFailure
|
||||
} from './actions';
|
||||
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
|
||||
import { LoginInfo, KEY_LOGIN_INFO } from '@app/types';
|
||||
|
@ -204,6 +209,59 @@ export class Effects {
|
|||
)
|
||||
);
|
||||
|
||||
inviteOrOpen$ = createEffect(() =>
|
||||
this.actions$.pipe(
|
||||
ofType(inviteOrOpen),
|
||||
withLatestFrom(
|
||||
this.store.pipe(
|
||||
select((state: any) => state.messenger.room.roomInfo as RoomInfo)
|
||||
)
|
||||
),
|
||||
exhaustMap(([action, roomInfo]) => {
|
||||
if (roomInfo.roomType === RoomType.Single) {
|
||||
// Re Open
|
||||
return this.roomProtocolService.open(action.req).pipe(
|
||||
map((res: OpenResponse) => {
|
||||
return openSuccess({ res });
|
||||
}),
|
||||
catchError(error => of(openFailure({ error })))
|
||||
);
|
||||
} else if (roomInfo.roomType === RoomType.Multi) {
|
||||
// Invite
|
||||
return this.roomProtocolService
|
||||
.invite({
|
||||
roomSeq: roomInfo.roomSeq,
|
||||
inviteUserSeqs: action.req.userSeqs
|
||||
})
|
||||
.pipe(
|
||||
map((res: InviteResponse) => {
|
||||
return inviteSuccess(res);
|
||||
}),
|
||||
catchError(error => of(inviteFailure({ error })))
|
||||
);
|
||||
} else {
|
||||
return of(inviteFailure({ error: 'room type is error!!' }));
|
||||
}
|
||||
})
|
||||
)
|
||||
);
|
||||
inviteSuccess$ = createEffect(() =>
|
||||
this.actions$.pipe(
|
||||
ofType(inviteSuccess),
|
||||
map(action => {
|
||||
return ChatStore.selectedRoom({ roomSeq: action.roomSeq });
|
||||
// const loginInfo = this.sessionStorageService.get<LoginInfo>(
|
||||
// KEY_LOGIN_INFO
|
||||
// );
|
||||
// return info({
|
||||
// roomSeq: action.roomSeq,
|
||||
// isDetail: true,
|
||||
// localeCode: loginInfo.localeCode
|
||||
// });
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
exit$ = createEffect(() =>
|
||||
this.actions$.pipe(
|
||||
ofType(exit),
|
||||
|
|
Loading…
Reference in New Issue
Block a user