From 101a7c86fc6534969ad443497cb29a10adff0b2c Mon Sep 17 00:00:00 2001 From: leejinho Date: Thu, 6 Feb 2020 15:19:03 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B8=B0=EC=A1=B4=EB=8C=80=ED=99=94=EB=B0=A9?= =?UTF-8?q?=EC=97=90=20=EB=8C=80=ED=99=94=EC=83=81=EB=8C=80=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=EC=8B=9C=20=EC=9D=B8=EC=9B=90=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?=EC=97=86=EC=9D=B4=20"=ED=99=95=EC=9D=B8"=20=EC=9D=84=20?= =?UTF-8?q?=EB=88=8C=EB=A0=80=EC=9D=84=EB=95=8C=20=EC=95=84=EB=AC=B4?= =?UTF-8?q?=EB=B0=98=EC=9D=91=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/messages.component.ts | 27 +++++++++++++++---- .../right-drawer/room-user-list.component.ts | 25 ++++++++++++++--- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts index b3cca3fc..acd4ffc8 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts @@ -1508,6 +1508,11 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit { break; case 'ADD_MEMBER': { + const curRoomUser = this.userInfoListSubject.value.filter( + user => + user.seq !== this.loginResSubject.value.userSeq && user.isJoinRoom + ); + const result = await this.dialogService.open< CreateChatDialogComponent, CreateChatDialogData, @@ -1517,15 +1522,27 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit { data: { type: UserSelectDialogType.EditChatMember, title: this.translateService.instant('chat.modifyRoomMember'), - curRoomUser: this.userInfoListSubject.value.filter( - user => - user.seq !== this.loginResSubject.value.userSeq && - user.isJoinRoom - ) + curRoomUser } }); if (!!result && !!result.choice && result.choice) { + if ( + !!result.selectedUserList && + result.selectedUserList.length > 0 && + curRoomUser + .map(user => user.seq) + .sort() + .join('|') === + result.selectedUserList + .map(user => user.seq) + .sort() + .join('|') + ) { + // 변경된 것이 없다면 중지. + return; + } + // include me here.. const userSeqs: number[] = this.userInfoListSubject.value .filter(userInfo => userInfo.isJoinRoom) diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/right-drawer/room-user-list.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/right-drawer/room-user-list.component.ts index 52acab5e..bf2db933 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/right-drawer/room-user-list.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/right-drawer/room-user-list.component.ts @@ -138,6 +138,10 @@ export class RoomUserListComponent implements OnInit, OnDestroy { } async onClickAddMember() { + const curRoomUser = this.userInfoList.filter( + user => user.seq !== this.loginRes.userSeq && user.isJoinRoom + ); + const result = await this.dialogService.open< CreateChatDialogComponent, CreateChatDialogData, @@ -147,18 +151,31 @@ export class RoomUserListComponent implements OnInit, OnDestroy { data: { type: UserSelectDialogType.EditChatMember, title: this.translateService.instant('chat.modifyRoomMember'), - curRoomUser: this.userInfoList.filter( - user => user.seq !== this.loginRes.userSeq && user.isJoinRoom - ) + curRoomUser } }); if (!!result && !!result.choice && result.choice) { + if ( + !!result.selectedUserList && + result.selectedUserList.length > 0 && + curRoomUser + .map(user => user.seq) + .sort() + .join('|') === + result.selectedUserList + .map(user => user.seq) + .sort() + .join('|') + ) { + // 변경된 것이 없다면 중지. + return; + } + // include me here.. const userSeqs: number[] = this.userInfoList .filter(userInfo => userInfo.isJoinRoom) .map(userInfo => userInfo.seq); - if (!!result.selectedUserList && result.selectedUserList.length > 0) { result.selectedUserList.forEach(user => { if (userSeqs.indexOf(user.seq) < 0) {