stream-chat-angular 5.11.0 → 5.11.2
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.
- package/assets/version.d.ts +1 -1
- package/esm2020/assets/version.mjs +2 -2
- package/esm2020/lib/channel.service.mjs +11 -1
- package/esm2020/lib/message/message.component.mjs +16 -5
- package/esm2020/lib/message-list/message-list.component.mjs +15 -7
- package/fesm2015/stream-chat-angular.mjs +40 -11
- package/fesm2015/stream-chat-angular.mjs.map +1 -1
- package/fesm2020/stream-chat-angular.mjs +40 -11
- package/fesm2020/stream-chat-angular.mjs.map +1 -1
- package/lib/channel.service.d.ts +4 -0
- package/package.json +1 -1
- package/src/assets/version.ts +1 -1
|
@@ -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 = '5.11.
|
|
23
|
+
const version = '5.11.2';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](/chat/docs/sdk/angular/components/NotificationListComponent/) component displays the currently active notifications.
|
|
@@ -447,6 +447,10 @@ class ChannelService {
|
|
|
447
447
|
this.chatClientService = chatClientService;
|
|
448
448
|
this.ngZone = ngZone;
|
|
449
449
|
this.notificationService = notificationService;
|
|
450
|
+
/**
|
|
451
|
+
* @internal
|
|
452
|
+
*/
|
|
453
|
+
this.isMessageLoadingInProgress = false;
|
|
450
454
|
this.messagePageSize = 25;
|
|
451
455
|
this.channelsSubject = new BehaviorSubject(undefined);
|
|
452
456
|
this.activeChannelSubject = new BehaviorSubject(undefined);
|
|
@@ -612,6 +616,7 @@ class ChannelService {
|
|
|
612
616
|
this.stopWatchForActiveChannelEvents(prevActiveChannel);
|
|
613
617
|
this.flushMarkReadQueue();
|
|
614
618
|
this.areReadEventsPaused = false;
|
|
619
|
+
this.isMessageLoadingInProgress = false;
|
|
615
620
|
const readState = channel.state.read[this.chatClientService.chatClient.user?.id || ''];
|
|
616
621
|
this.activeChannelLastReadMessageId = readState?.last_read_message_id;
|
|
617
622
|
if (channel.state.latestMessages[channel.state.latestMessages.length - 1]
|
|
@@ -651,6 +656,7 @@ class ChannelService {
|
|
|
651
656
|
this.activeChannelLastReadMessageId = undefined;
|
|
652
657
|
this.activeChannelUnreadCount = undefined;
|
|
653
658
|
this.areReadEventsPaused = false;
|
|
659
|
+
this.isMessageLoadingInProgress = false;
|
|
654
660
|
}
|
|
655
661
|
/**
|
|
656
662
|
* Sets the given `message` as an active parent message. If `undefined` is provided, it will deleselect the current parent message.
|
|
@@ -1177,6 +1183,7 @@ class ChannelService {
|
|
|
1177
1183
|
* @param parentMessageId The ID of the parent message if we want to load a thread message
|
|
1178
1184
|
*/
|
|
1179
1185
|
async jumpToMessage(messageId, parentMessageId) {
|
|
1186
|
+
this.isMessageLoadingInProgress = true;
|
|
1180
1187
|
const activeChannel = this.activeChannelSubject.getValue();
|
|
1181
1188
|
try {
|
|
1182
1189
|
await activeChannel?.state.loadMessageIntoState(messageId, parentMessageId);
|
|
@@ -1195,6 +1202,9 @@ class ChannelService {
|
|
|
1195
1202
|
this.notificationService.addTemporaryNotification('streamChat.Message not found');
|
|
1196
1203
|
throw error;
|
|
1197
1204
|
}
|
|
1205
|
+
finally {
|
|
1206
|
+
this.isMessageLoadingInProgress = false;
|
|
1207
|
+
}
|
|
1198
1208
|
}
|
|
1199
1209
|
/**
|
|
1200
1210
|
* Clears the currently selected message to jump
|
|
@@ -5181,7 +5191,7 @@ class MessageComponent {
|
|
|
5181
5191
|
this.hasTouchSupport = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
|
|
5182
5192
|
this.subscriptions = [];
|
|
5183
5193
|
this.isViewInited = false;
|
|
5184
|
-
this.urlRegexp = /(?:(?:https?|ftp|file):\/\/|www\.|ftp
|
|
5194
|
+
this.urlRegexp = /(?:(?:https?|ftp|file):\/\/|www\.|ftp\.|(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,})(?![^\s]*@[^\s]*)(?:[^\s()<>]+|\([\w\d]+\))*(?<!@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/gim;
|
|
5185
5195
|
this.emojiRegexp = new RegExp(emojiRegex(), 'g');
|
|
5186
5196
|
this.shouldPreventMessageMenuClose = false;
|
|
5187
5197
|
this._visibleMessageActionsCount = 0;
|
|
@@ -5551,9 +5561,20 @@ class MessageComponent {
|
|
|
5551
5561
|
if (this.displayAs === 'html') {
|
|
5552
5562
|
return content;
|
|
5553
5563
|
}
|
|
5554
|
-
content = content.replace(this.urlRegexp, (match) =>
|
|
5555
|
-
|
|
5556
|
-
|
|
5564
|
+
content = content.replace(this.urlRegexp, (match) => {
|
|
5565
|
+
if (this.messageService.customLinkRenderer) {
|
|
5566
|
+
return this.messageService.customLinkRenderer(match);
|
|
5567
|
+
}
|
|
5568
|
+
else {
|
|
5569
|
+
let href = match;
|
|
5570
|
+
if (!href.startsWith('http') &&
|
|
5571
|
+
!href.startsWith('ftp') &&
|
|
5572
|
+
!href.startsWith('file')) {
|
|
5573
|
+
href = `https://${match}`;
|
|
5574
|
+
}
|
|
5575
|
+
return `<a href="${href}" target="_blank" rel="nofollow">${match}</a>`;
|
|
5576
|
+
}
|
|
5577
|
+
});
|
|
5557
5578
|
return content;
|
|
5558
5579
|
}
|
|
5559
5580
|
updateReadByText() {
|
|
@@ -7780,9 +7801,9 @@ class MessageListComponent {
|
|
|
7780
7801
|
this.forceRepaint();
|
|
7781
7802
|
}));
|
|
7782
7803
|
this.subscriptions.push(this.channelService.activeChannel$.subscribe((channel) => {
|
|
7783
|
-
let
|
|
7804
|
+
let wasChannelSwitch = false;
|
|
7784
7805
|
if (this.channelId !== channel?.id) {
|
|
7785
|
-
|
|
7806
|
+
wasChannelSwitch = true;
|
|
7786
7807
|
if (this.checkIfUnreadNotificationIsVisibleTimeout) {
|
|
7787
7808
|
clearTimeout(this.checkIfUnreadNotificationIsVisibleTimeout);
|
|
7788
7809
|
}
|
|
@@ -7805,9 +7826,16 @@ class MessageListComponent {
|
|
|
7805
7826
|
unreadCount !== this.unreadCount) {
|
|
7806
7827
|
this.lastReadMessageId = lastReadMessageId;
|
|
7807
7828
|
this.unreadCount = unreadCount || 0;
|
|
7808
|
-
if (
|
|
7829
|
+
if (wasChannelSwitch && this.lastReadMessageId) {
|
|
7830
|
+
// Delay jumping to last read message in case we need to give precedence to channelService.jumpToMessage
|
|
7809
7831
|
if (this.openMessageListAt === 'last-read-message') {
|
|
7810
|
-
|
|
7832
|
+
setTimeout(() => {
|
|
7833
|
+
// Don't jump if a jump to a message was already started (using channelService.jumpToMessage)
|
|
7834
|
+
if (!this.isJumpingToMessage &&
|
|
7835
|
+
!this.channelService.isMessageLoadingInProgress) {
|
|
7836
|
+
this.jumpToFirstUnreadMessage();
|
|
7837
|
+
}
|
|
7838
|
+
}, 0);
|
|
7811
7839
|
}
|
|
7812
7840
|
else {
|
|
7813
7841
|
// Wait till messages and the unread banner is rendered
|
|
@@ -8193,8 +8221,9 @@ class MessageListComponent {
|
|
|
8193
8221
|
!this.firstUnreadMessageId &&
|
|
8194
8222
|
this.lastReadMessageId) {
|
|
8195
8223
|
const lastReadIndex = messages.findIndex((m) => m.id === this.lastReadMessageId);
|
|
8196
|
-
|
|
8197
|
-
messages[lastReadIndex + 1]?.id
|
|
8224
|
+
if (lastReadIndex !== -1) {
|
|
8225
|
+
this.firstUnreadMessageId = messages[lastReadIndex + 1]?.id;
|
|
8226
|
+
}
|
|
8198
8227
|
}
|
|
8199
8228
|
}), tap((messages) => (this.lastSentMessageId = [...messages]
|
|
8200
8229
|
.reverse()
|