bug of search is fixed

This commit is contained in:
richard-loafle 2020-02-06 15:30:25 +09:00
parent 14bd14340f
commit e2fde4ceb0
3 changed files with 79 additions and 65 deletions

View File

@ -145,65 +145,6 @@
> >
<mat-icon>more_vert</mat-icon> <mat-icon>more_vert</mat-icon>
</button> </button>
<mat-menu #contactMenu="matMenu">
<button
mat-menu-item
*ngIf="getShowContextMenu('OPEN_ALBUM_LIST')"
(click)="onClickContextMenu('OPEN_ALBUM_LIST')"
>
{{ 'chat.albumBox.label' | translate }}
</button>
<button
mat-menu-item
*ngIf="getShowContextMenu('OPEN_FILE_LIST')"
(click)="onClickContextMenu('OPEN_FILE_LIST')"
>
{{ 'chat.fileBox.label' | translate }}
</button>
<button
mat-menu-item
*ngIf="getShowContextMenu('CHAT_SEARCH')"
(click)="onClickContextMenu('CHAT_SEARCH')"
>
{{ 'chat.searchEventByText' | translate }}
</button>
<button
mat-menu-item
*ngIf="getShowContextMenu('OPEN_ROOM_USER')"
(click)="onClickContextMenu('OPEN_ROOM_USER')"
>
{{ 'chat.listOfRoomMember' | translate }}
</button>
<button
mat-menu-item
*ngIf="getShowContextMenu('ADD_MEMBER')"
(click)="onClickContextMenu('ADD_MEMBER')"
>
{{ 'chat.addMemberToRoom' | translate }}
</button>
<button
mat-menu-item
*ngIf="getShowContextMenu('ADD_GROUP')"
(click)="onClickContextMenu('ADD_GROUP')"
>
{{ 'chat.addMemberToGroup' | translate }}
</button>
<button
mat-menu-item
*ngIf="getShowContextMenu('EDIT_ROOM')"
(click)="onClickContextMenu('EDIT_ROOM')"
>
{{ 'chat.settingsOfRoom' | translate }}
</button>
<button
mat-menu-item
*ngIf="getShowContextMenu('CLOSE_ROOM')"
(click)="onClickContextMenu('CLOSE_ROOM')"
>
{{ 'chat.closeRoom' | translate }}
</button>
</mat-menu>
</div> </div>
</div> </div>
<div class="chat-search-frame"> <div class="chat-search-frame">
@ -251,6 +192,7 @@
[eventRemained$]="eventRemainedSubject.asObservable()" [eventRemained$]="eventRemainedSubject.asObservable()"
[userInfos$]="userInfoListSubject.asObservable()" [userInfos$]="userInfoListSubject.asObservable()"
[loginRes$]="loginResSubject.asObservable()" [loginRes$]="loginResSubject.asObservable()"
[lock$]="lockSubject.asObservable()"
[sessionVerInfo]="sessionVerInfo" [sessionVerInfo]="sessionVerInfo"
[isShowUnreadCount]="getShowUnreadCount()" [isShowUnreadCount]="getShowUnreadCount()"
[clearReadHere]="clearReadHere" [clearReadHere]="clearReadHere"
@ -335,6 +277,65 @@
</div> </div>
<!-- / CHAT --> <!-- / CHAT -->
<mat-menu #contactMenu="matMenu">
<button
mat-menu-item
*ngIf="getShowContextMenu('OPEN_ALBUM_LIST')"
(click)="onClickContextMenu('OPEN_ALBUM_LIST')"
>
{{ 'chat.albumBox.label' | translate }}
</button>
<button
mat-menu-item
*ngIf="getShowContextMenu('OPEN_FILE_LIST')"
(click)="onClickContextMenu('OPEN_FILE_LIST')"
>
{{ 'chat.fileBox.label' | translate }}
</button>
<button
mat-menu-item
*ngIf="getShowContextMenu('CHAT_SEARCH')"
(click)="onClickContextMenu('CHAT_SEARCH')"
>
{{ 'chat.searchEventByText' | translate }}
</button>
<button
mat-menu-item
*ngIf="getShowContextMenu('OPEN_ROOM_USER')"
(click)="onClickContextMenu('OPEN_ROOM_USER')"
>
{{ 'chat.listOfRoomMember' | translate }}
</button>
<button
mat-menu-item
*ngIf="getShowContextMenu('ADD_MEMBER')"
(click)="onClickContextMenu('ADD_MEMBER')"
>
{{ 'chat.addMemberToRoom' | translate }}
</button>
<button
mat-menu-item
*ngIf="getShowContextMenu('ADD_GROUP')"
(click)="onClickContextMenu('ADD_GROUP')"
>
{{ 'chat.addMemberToGroup' | translate }}
</button>
<button
mat-menu-item
*ngIf="getShowContextMenu('EDIT_ROOM')"
(click)="onClickContextMenu('EDIT_ROOM')"
>
{{ 'chat.settingsOfRoom' | translate }}
</button>
<button
mat-menu-item
*ngIf="getShowContextMenu('CLOSE_ROOM')"
(click)="onClickContextMenu('CLOSE_ROOM')"
>
{{ 'chat.closeRoom' | translate }}
</button>
</mat-menu>
<div <div
style="visibility: hidden; position: fixed" style="visibility: hidden; position: fixed"
[style.left]="messageContextMenuPosition.x" [style.left]="messageContextMenuPosition.x"
@ -355,14 +356,14 @@
<button <button
mat-menu-item mat-menu-item
*ngIf="isForwardableMessage(message, eventInfoStatusSubject.value)" *ngIf="isForwardableMessage(message, eventInfoStatusSubject.value)"
(click)="onClickMessageContextMenu('REPLAY', message)" (click)="onClickMessageContextMenu('FORWARD', message)"
> >
{{ 'chat.forwardEventTo' | translate }} {{ 'chat.forwardEventTo' | translate }}
</button> </button>
<button <button
mat-menu-item mat-menu-item
*ngIf="isForwardableMessage(message, eventInfoStatusSubject.value)" *ngIf="isForwardableMessage(message, eventInfoStatusSubject.value)"
(click)="onClickMessageContextMenu('REPLAY_TO_ME', message)" (click)="onClickMessageContextMenu('FORWARD_TO_ME', message)"
> >
{{ 'chat.forwardEventToMe' | translate }} {{ 'chat.forwardEventToMe' | translate }}
</button> </button>

View File

@ -177,6 +177,8 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
eventRemainedSubscription: Subscription; eventRemainedSubscription: Subscription;
eventRemainedSubject = new BehaviorSubject<boolean>(false); // 이전대화가 남아 있는지 여부 eventRemainedSubject = new BehaviorSubject<boolean>(false); // 이전대화가 남아 있는지 여부
lockSubject = new BehaviorSubject<boolean>(false);
sessionVerInfo: VersionInfo2Response; sessionVerInfo: VersionInfo2Response;
baseEventSeq = 0; baseEventSeq = 0;
@ -305,6 +307,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
) )
) )
.subscribe(process => { .subscribe(process => {
this.lockSubject.next(process);
this.searchEventListProcessing = process; this.searchEventListProcessing = process;
if (!process && this.isShowSearchArea) { if (!process && this.isShowSearchArea) {
this.doSearchTextInEvent(this.searchText); this.doSearchTextInEvent(this.searchText);
@ -1355,7 +1358,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
} }
} }
break; break;
case 'REPLAY': case 'FORWARD':
{ {
const result = await this.dialogService.open< const result = await this.dialogService.open<
CreateChatDialogComponent, CreateChatDialogComponent,
@ -1401,7 +1404,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
} }
} }
break; break;
case 'REPLAY_TO_ME': case 'FORWARD_TO_ME':
{ {
if (this.loginResSubject.value.talkWithMeBotSeq > -1) { if (this.loginResSubject.value.talkWithMeBotSeq > -1) {
this.store.dispatch( this.store.dispatch(
@ -1795,7 +1798,8 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
this.store.dispatch(EventStore.infoForSearchEnd({})); this.store.dispatch(EventStore.infoForSearchEnd({}));
this.chatMessages.gotoPosition(this.searchedFocusEvent.seq); // this.chatMessages.gotoPosition(this.searchedFocusEvent.seq);
this.chatMessages.initEventMore(this.searchedFocusEvent.seq);
} else { } else {
this.searchTotalCount = 0; this.searchTotalCount = 0;
this.searchCurrentIndex = 0; this.searchCurrentIndex = 0;

View File

@ -60,6 +60,9 @@ export class MessagesComponent implements OnInit, OnDestroy {
@Input() @Input()
userInfos$: Observable<UserInfo[]>; userInfos$: Observable<UserInfo[]>;
@Input()
lock$: Observable<boolean>;
@Input() @Input()
isShowUnreadCount = true; isShowUnreadCount = true;
@Input() @Input()
@ -129,6 +132,7 @@ export class MessagesComponent implements OnInit, OnDestroy {
firstCheckReadHere = true; firstCheckReadHere = true;
initRoomLastEventSeq: number; initRoomLastEventSeq: number;
baseEventSeq = 0; baseEventSeq = 0;
gotoEventSeq: number;
loginRes: LoginResponse; loginRes: LoginResponse;
loginResSubscription: Subscription; loginResSubscription: Subscription;
@ -536,6 +540,10 @@ export class MessagesComponent implements OnInit, OnDestroy {
() => {}, () => {},
() => { () => {
this.initalized = true; this.initalized = true;
if (!!this.gotoEventSeq) {
this.gotoPosition(this.gotoEventSeq);
this.gotoEventSeq = undefined;
}
}, },
-1 === this.virtualScroller.viewPortInfo.endIndex || -1 === this.virtualScroller.viewPortInfo.endIndex ||
!isInViewPortItems, !isInViewPortItems,
@ -545,11 +553,12 @@ export class MessagesComponent implements OnInit, OnDestroy {
} }
} }
initEventMore() { initEventMore(gotoEventSeq?: number) {
// 방정보가 바뀌면 이전대화 보기 관련 값들을 초기화 한다. // 방정보가 바뀌면 이전대화 보기 관련 값들을 초기화 한다.
this.scrollUpInitalized = false; this.scrollUpInitalized = false;
this.storedScrollItem = undefined; this.storedScrollItem = undefined;
this.storedScrollItemOffsetTop = undefined; this.storedScrollItemOffsetTop = undefined;
this.gotoEventSeq = gotoEventSeq;
} }
clear() {} clear() {}