This commit is contained in:
Richard Park 2020-01-21 17:46:19 +09:00
commit 09e419c917
3 changed files with 20 additions and 22 deletions

View File

@ -1666,14 +1666,13 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
} }
onClickOpenProfile(userSeq: number) { onClickOpenProfile(userSeq: number) {
const roomType = this.roomInfoSubject.value.roomType;
if ( if (
[ roomType !== RoomType.Allim &&
RoomType.Allim, roomType !== RoomType.Bot &&
RoomType.Bot, roomType !== RoomType.Link &&
RoomType.Link, roomType !== RoomType.Allim_Elephant &&
RoomType.Allim_Elephant, roomType !== RoomType.Allim_TMS
RoomType.Allim_TMS
].some(v => v === this.roomInfoSubject.value.roomType)
) { ) {
this.openProfile.emit({ userSeq }); this.openProfile.emit({ userSeq });
} }

View File

@ -58,7 +58,7 @@
[mine]="message.senderSeq === loginRes.userSeq" [mine]="message.senderSeq === loginRes.userSeq"
[highlight]="isHighlightedEvent(message.seq)" [highlight]="isHighlightedEvent(message.seq)"
[existReadToHere]=" [existReadToHere]="
readToHereEvent && readToHereEvent.seq === message.seq !!readToHereEvent && readToHereEvent.seq === message.seq
" "
[dateChanged]="getDateSplitter(message)" [dateChanged]="getDateSplitter(message)"
[senderName]="getUserName(message.senderSeq)" [senderName]="getUserName(message.senderSeq)"

View File

@ -169,20 +169,26 @@ export class MessagesComponent implements OnInit, OnDestroy {
this.roomInfo = roomInfo; this.roomInfo = roomInfo;
}); });
this.eventListSubscription = this.eventList$.subscribe(eventList => { this.eventListSubscription = this.eventList$.subscribe(eventList => {
if (!!eventList && eventList.length > 0 && this.baseEventSeq === 0) {
this.initRoomLastEventSeq = eventList[eventList.length - 1].seq;
}
if ( if (
!!eventList && !!eventList &&
eventList.length > 0 && eventList.length > 0 &&
this.baseEventSeq > 0 &&
!!this.roomInfo && !!this.roomInfo &&
!!this.roomInfo.lastReadEventSeq && !!this.roomInfo.lastReadEventSeq &&
this.baseEventSeq <= this.roomInfo.lastReadEventSeq this.baseEventSeq <= this.roomInfo.lastReadEventSeq
) { ) {
// 조회된 내용중에 read here 가 있을 경우. // 기존 대화 내용이 있는 상태에서 추가로 조회된 내용중에 read here 가 있을 경우.
this.firstCheckReadHere = false; this.firstCheckReadHere = false;
} }
this.readToHereEvent = eventList.find(e => this.getReadHere(e));
this.eventList = eventList; this.eventList = eventList;
this.readToHereEvent = this.getReadHere();
this.changeDetectorRef.detectChanges(); this.changeDetectorRef.detectChanges();
if (this.searchingMode) { if (this.searchingMode) {
@ -339,7 +345,7 @@ export class MessagesComponent implements OnInit, OnDestroy {
return false; return false;
} }
getReadHere(message: Info<EventJson>): boolean { getReadHere(): Info<EventJson> | undefined {
if ( if (
!!this.roomInfo && !!this.roomInfo &&
!!this.roomInfo.lastReadEventSeq && !!this.roomInfo.lastReadEventSeq &&
@ -351,20 +357,13 @@ export class MessagesComponent implements OnInit, OnDestroy {
this.roomInfo.roomType === RoomType.Multi this.roomInfo.roomType === RoomType.Multi
) { ) {
if (!this.roomInfo.isTimeRoom) { if (!this.roomInfo.isTimeRoom) {
const messageIndex = this.eventList.findIndex( return this.eventList.find(
v => v.seq === message.seq v => v.seq === this.roomInfo.lastReadEventSeq + 1
); );
if (
this.eventList[messageIndex].seq ===
this.roomInfo.lastReadEventSeq + 1
) {
return true;
} }
} }
} }
} return undefined;
return false;
} }
getStringReadHereMore(): string { getStringReadHereMore(): string {