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 @@