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.
@@ -1 +1 @@
1
- export declare const version = "4.39.0";
1
+ export declare const version = "4.39.1";
@@ -356,7 +356,7 @@
356
356
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
357
357
  }
358
358
 
359
- var version = '4.39.0';
359
+ var version = '4.39.1';
360
360
 
361
361
  /**
362
362
  * The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
@@ -806,7 +806,6 @@
806
806
  * @param channel
807
807
  */
808
808
  ChannelService.prototype.setAsActiveChannel = function (channel) {
809
- var _this = this;
810
809
  var prevActiveChannel = this.activeChannelSubject.getValue();
811
810
  if ((prevActiveChannel === null || prevActiveChannel === void 0 ? void 0 : prevActiveChannel.cid) === channel.cid) {
812
811
  return;
@@ -815,23 +814,7 @@
815
814
  this.watchForActiveChannelEvents(channel);
816
815
  this.addChannel(channel);
817
816
  this.activeChannelSubject.next(channel);
818
- channel.state.messages.forEach(function (m) {
819
- m.readBy = getReadBy(m, channel);
820
- m.translation = getMessageTranslation(m, channel, _this.chatClientService.chatClient.user);
821
- if (m.quoted_message) {
822
- m.quoted_message.translation = getMessageTranslation(m.quoted_message, channel, _this.chatClientService.chatClient.user);
823
- }
824
- });
825
- if (this.canSendReadEvents && this.shouldMarkActiveChannelAsRead) {
826
- void channel.markRead();
827
- }
828
- this.activeChannelMessagesSubject.next(__spreadArray([], __read(channel.state.messages)));
829
- this.activeChannelPinnedMessagesSubject.next(__spreadArray([], __read(channel.state.pinnedMessages)));
830
- this.activeParentMessageIdSubject.next(undefined);
831
- this.activeThreadMessagesSubject.next([]);
832
- this.messageToQuoteSubject.next(undefined);
833
- this.usersTypingInChannelSubject.next([]);
834
- this.usersTypingInThreadSubject.next([]);
817
+ this.setChannelState(channel);
835
818
  };
836
819
  /**
837
820
  * Deselects the currently active (if any) channel
@@ -1474,7 +1457,7 @@
1474
1457
  switch (clientEvent.eventType) {
1475
1458
  case 'connection.recovered': {
1476
1459
  void this.ngZone.run(function () { return __awaiter(_this, void 0, void 0, function () {
1477
- var shoulSetActiveChannel, _a_1;
1460
+ var shoulSetActiveChannel, messageToQuote_1, messages_3, updatedMessageToQuote, _a_1;
1478
1461
  return __generator(this, function (_h) {
1479
1462
  switch (_h.label) {
1480
1463
  case 0:
@@ -1493,8 +1476,19 @@
1493
1476
  return [4 /*yield*/, this.queryChannels(shoulSetActiveChannel || false, true)];
1494
1477
  case 2:
1495
1478
  _h.sent();
1496
- // Thread messages are not refetched so active thread gets deselected to avoid displaying stale messages
1497
- void this.setAsActiveParentMessage(undefined);
1479
+ if (this.activeChannelSubject.getValue()) {
1480
+ // Thread messages are not refetched so active thread gets deselected to avoid displaying stale messages
1481
+ void this.setAsActiveParentMessage(undefined);
1482
+ messageToQuote_1 = this.messageToQuoteSubject.getValue();
1483
+ this.setChannelState(this.activeChannelSubject.getValue());
1484
+ this.activeChannelMessages$
1485
+ .pipe(operators.take(1))
1486
+ .subscribe(function (m) { return (messages_3 = m); });
1487
+ updatedMessageToQuote = messages_3.find(function (m) { return m.id === (messageToQuote_1 === null || messageToQuote_1 === void 0 ? void 0 : messageToQuote_1.id); });
1488
+ if (updatedMessageToQuote) {
1489
+ this.selectMessageToQuote(updatedMessageToQuote);
1490
+ }
1491
+ }
1498
1492
  this.isStateRecoveryInProgress = false;
1499
1493
  return [3 /*break*/, 4];
1500
1494
  case 3:
@@ -2035,6 +2029,26 @@
2035
2029
  this.latestMessageDateByUserByChannelsSubject.next(Object.assign({}, latestMessages));
2036
2030
  }
2037
2031
  };
2032
+ ChannelService.prototype.setChannelState = function (channel) {
2033
+ var _this = this;
2034
+ channel.state.messages.forEach(function (m) {
2035
+ m.readBy = getReadBy(m, channel);
2036
+ m.translation = getMessageTranslation(m, channel, _this.chatClientService.chatClient.user);
2037
+ if (m.quoted_message) {
2038
+ m.quoted_message.translation = getMessageTranslation(m.quoted_message, channel, _this.chatClientService.chatClient.user);
2039
+ }
2040
+ });
2041
+ if (this.canSendReadEvents && this.shouldMarkActiveChannelAsRead) {
2042
+ void channel.markRead();
2043
+ }
2044
+ this.activeChannelMessagesSubject.next(__spreadArray([], __read(channel.state.messages)));
2045
+ this.activeChannelPinnedMessagesSubject.next(__spreadArray([], __read(channel.state.pinnedMessages)));
2046
+ this.activeParentMessageIdSubject.next(undefined);
2047
+ this.activeThreadMessagesSubject.next([]);
2048
+ this.messageToQuoteSubject.next(undefined);
2049
+ this.usersTypingInChannelSubject.next([]);
2050
+ this.usersTypingInThreadSubject.next([]);
2051
+ };
2038
2052
  return ChannelService;
2039
2053
  }());
2040
2054
  ChannelService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: ChannelService, deps: [{ token: ChatClientService }, { token: i0__namespace.NgZone }, { token: NotificationService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });