stream-chat-angular 5.7.2 → 5.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,7 +21,7 @@ import transliterate from '@stream-io/transliterate';
21
21
  import * as i7 from 'angular-mentions';
22
22
  import { MentionModule } from 'angular-mentions';
23
23
 
24
- const version = '5.7.2';
24
+ const version = '5.7.3';
25
25
 
26
26
  /**
27
27
  * The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
@@ -7772,6 +7772,9 @@ class MessageListComponent {
7772
7772
  }
7773
7773
  }));
7774
7774
  this.subscriptions.push(this.channelService.activeParentMessage$.subscribe((message) => {
7775
+ if (!message && this.parentMessage && this.mode === 'thread') {
7776
+ this.resetScrollState();
7777
+ }
7775
7778
  if (message &&
7776
7779
  this.parentMessage &&
7777
7780
  message.id !== this.parentMessage.id &&
@@ -7935,6 +7938,12 @@ class MessageListComponent {
7935
7938
  }
7936
7939
  return;
7937
7940
  }
7941
+ if (this.scrollContainer.nativeElement.scrollHeight >
7942
+ this.scrollContainer.nativeElement.clientHeight) {
7943
+ if (!this.isJumpToLatestButtonVisible) {
7944
+ this.isJumpToLatestButtonVisible = true;
7945
+ }
7946
+ }
7938
7947
  this.scroll$.next();
7939
7948
  let scrollPosition = this.getScrollPosition();
7940
7949
  const isUserScrolled = (this.direction === 'bottom-to-top'
@@ -8053,16 +8062,16 @@ class MessageListComponent {
8053
8062
  }
8054
8063
  getScrollPosition() {
8055
8064
  let position = 'middle';
8056
- if (Math.floor(this.scrollContainer.nativeElement.scrollTop) <=
8057
- (this.parentMessageElement?.nativeElement.clientHeight || 0)) {
8058
- position = 'top';
8059
- }
8060
- else if (Math.ceil(this.scrollContainer.nativeElement.scrollTop) +
8065
+ if (Math.ceil(this.scrollContainer.nativeElement.scrollTop) +
8061
8066
  this.scrollContainer.nativeElement.clientHeight +
8062
8067
  1 >=
8063
8068
  this.scrollContainer.nativeElement.scrollHeight) {
8064
8069
  position = 'bottom';
8065
8070
  }
8071
+ else if (Math.floor(this.scrollContainer.nativeElement.scrollTop) <=
8072
+ (this.parentMessageElement?.nativeElement?.clientHeight || 0)) {
8073
+ position = 'top';
8074
+ }
8066
8075
  return position;
8067
8076
  }
8068
8077
  setMessages$() {
@@ -8080,11 +8089,7 @@ class MessageListComponent {
8080
8089
  }
8081
8090
  }
8082
8091
  });
8083
- this.messages$ = this.virtualizedList.virtualizedItems$.pipe(tap((messages) => {
8084
- if (messages.length === 0) {
8085
- this.resetScrollState();
8086
- return;
8087
- }
8092
+ this.messages$ = this.virtualizedList.virtualizedItems$.pipe(tap(() => {
8088
8093
  if (this.isEmpty) {
8089
8094
  // cdRef.detectChanges() isn't enough here, test will fail
8090
8095
  setTimeout(() => (this.isEmpty = false), 0);
@@ -8109,6 +8114,8 @@ class MessageListComponent {
8109
8114
  this.isLatestMessageInList =
8110
8115
  !latestMessageInList ||
8111
8116
  latestMessageInList.cid !== channel?.cid ||
8117
+ (this.mode === 'thread' &&
8118
+ latestMessageInList?.parent_id !== this.parentMessage?.id) ||
8112
8119
  latestMessageInList?.id ===
8113
8120
  messagesFromState[messagesFromState.length - 1]?.id;
8114
8121
  if (!this.isLatestMessageInList) {