stream-chat-angular 4.39.0 → 4.39.1

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.
@@ -20,7 +20,7 @@ import transliterate from '@stream-io/transliterate';
20
20
  import * as i8 from 'angular-mentions';
21
21
  import { MentionModule } from 'angular-mentions';
22
22
 
23
- const version = '4.39.0';
23
+ const version = '4.39.1';
24
24
 
25
25
  /**
26
26
  * The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
@@ -409,25 +409,7 @@ class ChannelService {
409
409
  this.watchForActiveChannelEvents(channel);
410
410
  this.addChannel(channel);
411
411
  this.activeChannelSubject.next(channel);
412
- channel.state.messages.forEach((m) => {
413
- m.readBy = getReadBy(m, channel);
414
- m.translation = getMessageTranslation(m, channel, this.chatClientService.chatClient.user);
415
- if (m.quoted_message) {
416
- m.quoted_message.translation = getMessageTranslation(m.quoted_message, channel, this.chatClientService.chatClient.user);
417
- }
418
- });
419
- if (this.canSendReadEvents && this.shouldMarkActiveChannelAsRead) {
420
- void channel.markRead();
421
- }
422
- this.activeChannelMessagesSubject.next([...channel.state.messages]);
423
- this.activeChannelPinnedMessagesSubject.next([
424
- ...channel.state.pinnedMessages,
425
- ]);
426
- this.activeParentMessageIdSubject.next(undefined);
427
- this.activeThreadMessagesSubject.next([]);
428
- this.messageToQuoteSubject.next(undefined);
429
- this.usersTypingInChannelSubject.next([]);
430
- this.usersTypingInThreadSubject.next([]);
412
+ this.setChannelState(channel);
431
413
  }
432
414
  /**
433
415
  * Deselects the currently active (if any) channel
@@ -916,8 +898,21 @@ class ChannelService {
916
898
  const shoulSetActiveChannel = this.shouldSetActiveChannel &&
917
899
  !this.activeChannelSubject.getValue();
918
900
  yield this.queryChannels(shoulSetActiveChannel || false, true);
919
- // Thread messages are not refetched so active thread gets deselected to avoid displaying stale messages
920
- void this.setAsActiveParentMessage(undefined);
901
+ if (this.activeChannelSubject.getValue()) {
902
+ // Thread messages are not refetched so active thread gets deselected to avoid displaying stale messages
903
+ void this.setAsActiveParentMessage(undefined);
904
+ // Update and reselect message to quote
905
+ const messageToQuote = this.messageToQuoteSubject.getValue();
906
+ this.setChannelState(this.activeChannelSubject.getValue());
907
+ let messages;
908
+ this.activeChannelMessages$
909
+ .pipe(take(1))
910
+ .subscribe((m) => (messages = m));
911
+ const updatedMessageToQuote = messages.find((m) => m.id === (messageToQuote === null || messageToQuote === void 0 ? void 0 : messageToQuote.id));
912
+ if (updatedMessageToQuote) {
913
+ this.selectMessageToQuote(updatedMessageToQuote);
914
+ }
915
+ }
921
916
  this.isStateRecoveryInProgress = false;
922
917
  }
923
918
  catch (_a) {
@@ -1407,6 +1402,27 @@ class ChannelService {
1407
1402
  this.latestMessageDateByUserByChannelsSubject.next(Object.assign({}, latestMessages));
1408
1403
  }
1409
1404
  }
1405
+ setChannelState(channel) {
1406
+ channel.state.messages.forEach((m) => {
1407
+ m.readBy = getReadBy(m, channel);
1408
+ m.translation = getMessageTranslation(m, channel, this.chatClientService.chatClient.user);
1409
+ if (m.quoted_message) {
1410
+ m.quoted_message.translation = getMessageTranslation(m.quoted_message, channel, this.chatClientService.chatClient.user);
1411
+ }
1412
+ });
1413
+ if (this.canSendReadEvents && this.shouldMarkActiveChannelAsRead) {
1414
+ void channel.markRead();
1415
+ }
1416
+ this.activeChannelMessagesSubject.next([...channel.state.messages]);
1417
+ this.activeChannelPinnedMessagesSubject.next([
1418
+ ...channel.state.pinnedMessages,
1419
+ ]);
1420
+ this.activeParentMessageIdSubject.next(undefined);
1421
+ this.activeThreadMessagesSubject.next([]);
1422
+ this.messageToQuoteSubject.next(undefined);
1423
+ this.usersTypingInChannelSubject.next([]);
1424
+ this.usersTypingInThreadSubject.next([]);
1425
+ }
1410
1426
  }
1411
1427
  ChannelService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: ChannelService, deps: [{ token: ChatClientService }, { token: i0.NgZone }, { token: NotificationService }], target: i0.ɵɵFactoryTarget.Injectable });
1412
1428
  ChannelService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: ChannelService, providedIn: 'root' });