stream-chat-angular 4.28.0 → 4.29.0

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.
@@ -19,7 +19,7 @@ import transliterate from '@stream-io/transliterate';
19
19
  import * as i8$1 from 'angular-mentions';
20
20
  import { MentionModule } from 'angular-mentions';
21
21
 
22
- const version = '4.28.0';
22
+ const version = '4.29.0';
23
23
 
24
24
  /**
25
25
  * The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
@@ -387,12 +387,15 @@ class ChannelService {
387
387
  }
388
388
  /**
389
389
  * Sets the given `channel` as active and marks it as read.
390
+ * If the channel wasn't previously part of the channel, it will be added to the beginning of the list.
391
+ *
390
392
  * @param channel
391
393
  */
392
394
  setAsActiveChannel(channel) {
393
395
  const prevActiveChannel = this.activeChannelSubject.getValue();
394
396
  this.stopWatchForActiveChannelEvents(prevActiveChannel);
395
397
  this.watchForActiveChannelEvents(channel);
398
+ this.addChannel(channel);
396
399
  this.activeChannelSubject.next(channel);
397
400
  channel.state.messages.forEach((m) => {
398
401
  m.readBy = getReadBy(m, channel);
@@ -766,6 +769,17 @@ class ChannelService {
766
769
  selectMessageToQuote(message) {
767
770
  this.messageToQuoteSubject.next(message);
768
771
  }
772
+ /**
773
+ * Add a new channel to the channel list
774
+ * The channel will be added to the beginning of the channel list
775
+ * @param channel
776
+ */
777
+ addChannel(channel) {
778
+ if (!this.channels.find((c) => c.cid === channel.cid)) {
779
+ this.channelsSubject.next([channel, ...this.channels]);
780
+ this.watchForChannelEvents(channel);
781
+ }
782
+ }
769
783
  sendMessageRequest(preview, customData) {
770
784
  var _a;
771
785
  return __awaiter(this, void 0, void 0, function* () {