From ec7fbdbeccafb39b5c8d85fabdd9ae431da98a58 Mon Sep 17 00:00:00 2001 From: leejinho Date: Thu, 9 Jan 2020 10:41:41 +0900 Subject: [PATCH] =?UTF-8?q?#=20=EC=9D=B4=EC=8A=88=EC=B2=98=EB=A6=AC=2087?= =?UTF-8?q?=20=EC=9E=90=EB=8F=99=EC=99=84=EC=84=B1=EB=AA=A9=EB=A1=9D=20?= =?UTF-8?q?=EC=82=AC=EC=9A=A9=EC=9E=90=20=EC=97=AC=EB=9F=AC=20=EB=B2=88=20?= =?UTF-8?q?=EB=B3=B4=EC=97=AC=EC=A4=8C=20::=20=EC=A4=91=EB=B3=B5=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0.=20137=20=EB=B2=88=EC=97=AD=20=EB=8C=80?= =?UTF-8?q?=ED=99=94=20=EA=B2=80=EC=83=89=EB=90=98=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EC=9D=8C=20::=20=EB=B2=88=EC=97=AD=20=EB=8C=80=ED=99=94=20?= =?UTF-8?q?=EA=B2=80=EC=83=89=EB=90=98=EB=8F=84=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/left-sidenav/chat.component.ts | 43 ++++++------------- .../components/messages.component.html | 4 +- .../components/messages.component.ts | 3 ++ .../src/lib/models/info.ts | 12 +++++- 4 files changed, 27 insertions(+), 35 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/chat.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/chat.component.ts index 14c2031e..ddf50cf8 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/chat.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/chat.component.ts @@ -26,11 +26,8 @@ import { import * as AppStore from '@app/store'; import * as ChatStore from '@app/store/messenger/chat'; import * as RoomStore from '@app/store/messenger/room'; -import { tap, debounceTime, delay, take } from 'rxjs/operators'; -import { - RoomUserDetailData, - RoomUserData -} from '@ucap-webmessenger/protocol-sync'; +import { tap, debounceTime } from 'rxjs/operators'; +import { RoomUserData } from '@ucap-webmessenger/protocol-sync'; import { VersionInfo2Response } from '@ucap-webmessenger/api-public'; import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { KEY_VER_INFO } from '@app/types'; @@ -62,7 +59,6 @@ export class ChatComponent implements OnInit, OnDestroy, AfterViewChecked { chatContextMenuPosition = { x: '0px', y: '0px' }; roomList: RoomInfo[]; - roomUserList: RoomUserDetailData[]; roomUserShortList: RoomUserData[]; sessionVerinfo: VersionInfo2Response; @@ -118,17 +114,17 @@ export class ChatComponent implements OnInit, OnDestroy, AfterViewChecked { this.store.pipe( select(AppStore.MessengerSelector.SyncSelector.selectAllRoom) ), - this.store.pipe( - select(AppStore.MessengerSelector.SyncSelector.selectAllRoomUser) - ), this.store.pipe( select(AppStore.MessengerSelector.SyncSelector.selectAllRoomUserShort) ) ]) .pipe( - tap(([room, roomUser, roomUserShort]) => { + tap(([room, roomUserShort]) => { + if (!room || !roomUserShort || roomUserShort.length === 0) { + return; + } + this.roomList = room; - this.roomUserList = roomUser; this.roomUserShortList = roomUserShort; const recommendedWordList = []; @@ -137,15 +133,6 @@ export class ChatComponent implements OnInit, OnDestroy, AfterViewChecked { recommendedWordList.push(r.roomName); } } - for (const ru of roomUser) { - for (const u of ru.userInfos) { - if (u.seq !== this.loginRes.userSeq) { - if (!!u.name && '' !== u.name.trim()) { - recommendedWordList.push(u.name); - } - } - } - } for (const ru of roomUserShort) { for (const u of ru.userInfos) { if (u.seq !== this.loginRes.userSeq) { @@ -155,8 +142,11 @@ export class ChatComponent implements OnInit, OnDestroy, AfterViewChecked { } } } - - this.recommendedWordList = [...recommendedWordList]; + this.recommendedWordList = [ + ...recommendedWordList.filter( + (item, index) => recommendedWordList.indexOf(item) === index + ) + ]; if (!!this.isSearch) { this.searchRoomList = room.filter( @@ -285,15 +275,6 @@ export class ChatComponent implements OnInit, OnDestroy, AfterViewChecked { } getRoomUserList(roomInfo: RoomInfo): (RoomUserInfo | UserInfoShort)[] { - if (!!this.roomUserList && 0 < this.roomUserList.length) { - const i = this.roomUserList.findIndex( - value => roomInfo.roomSeq === value.roomSeq - ); - if (-1 < i) { - return this.roomUserList[i].userInfos; - } - } - if (!!this.roomUserShortList && 0 < this.roomUserShortList.length) { const i = this.roomUserShortList.findIndex( value => roomInfo.roomSeq === value.roomSeq diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html index 151facbc..423c023d 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html @@ -336,14 +336,14 @@