stream-chat 10.0.0-rc.33 → 10.0.0-rc.34
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/dist/cjs/index.browser.js +140 -44
- package/dist/cjs/index.browser.js.map +2 -2
- package/dist/cjs/index.node.js +140 -44
- package/dist/cjs/index.node.js.map +2 -2
- package/dist/esm/index.mjs +140 -44
- package/dist/esm/index.mjs.map +2 -2
- package/dist/types/channel.d.ts +9 -0
- package/dist/types/client.d.ts +2 -1
- package/dist/types/pagination/paginators/BasePaginator.d.ts +11 -0
- package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +5 -1
- package/dist/types/pagination/paginators/MessagePaginator.d.ts +29 -16
- package/package.json +1 -1
- package/src/channel.ts +37 -1
- package/src/client.ts +13 -3
- package/src/messageComposer/attachmentManager.ts +10 -4
- package/src/messageComposer/middleware/messageComposer/linkPreviews.ts +4 -3
- package/src/pagination/paginators/BasePaginator.ts +21 -3
- package/src/pagination/paginators/MessageIntervalPaginator.ts +8 -1
- package/src/pagination/paginators/MessagePaginator.ts +104 -50
|
@@ -2993,10 +2993,11 @@ var _AttachmentManager = class _AttachmentManager {
|
|
|
2993
2993
|
this.getUploadConfigCheck = async (fileLike) => {
|
|
2994
2994
|
const client = this.channel.getClient();
|
|
2995
2995
|
let appSettings;
|
|
2996
|
-
|
|
2997
|
-
appSettings = await client.getAppSettings();
|
|
2998
|
-
}
|
|
2999
|
-
appSettings = await client.
|
|
2996
|
+
try {
|
|
2997
|
+
appSettings = await (client.appSettingsPromise ?? client.getAppSettings());
|
|
2998
|
+
} catch (error) {
|
|
2999
|
+
appSettings = client.userId ? await client.offlineDb?.getAppSettings({ userId: client.userId }).catch(() => null) : null;
|
|
3000
|
+
if (!appSettings) throw error;
|
|
3000
3001
|
}
|
|
3001
3002
|
const uploadConfig = isImageFile(fileLike) ? appSettings?.app?.image_upload_config : appSettings?.app?.file_upload_config;
|
|
3002
3003
|
if (!uploadConfig) return { uploadBlocked: false };
|
|
@@ -5124,6 +5125,8 @@ var BasePaginator = class {
|
|
|
5124
5125
|
this._itemIntervals = /* @__PURE__ */ new Map();
|
|
5125
5126
|
/** How many claims on the active interval were made; the latest one decides it. */
|
|
5126
5127
|
this._activeIntervalClaimCount = 0;
|
|
5128
|
+
/** Set by `setItems`, which loads a page (even an empty one) without a query. */
|
|
5129
|
+
this._pageSetWithoutQuery = false;
|
|
5127
5130
|
this.boosts = /* @__PURE__ */ new Map();
|
|
5128
5131
|
this._maxBoostSeq = 0;
|
|
5129
5132
|
/** Boosted items first (higher `seq` first), then `itemOrderComparator`. */
|
|
@@ -5265,6 +5268,17 @@ var BasePaginator = class {
|
|
|
5265
5268
|
get isInitialized() {
|
|
5266
5269
|
return typeof this._lastQueryShape !== "undefined";
|
|
5267
5270
|
}
|
|
5271
|
+
/**
|
|
5272
|
+
* True once a page was loaded: by a query, or by `setItems`, including an empty page (e.g. a
|
|
5273
|
+
* catch-all list seeded so it never runs its own query). Items that live events ingested into a
|
|
5274
|
+
* never-queried list are not a loaded page, although they make `items` defined: a UI deciding
|
|
5275
|
+
* whether to run the first query reads this, not `items === undefined`. Unlike `isInitialized`,
|
|
5276
|
+
* an empty `setItems` page counts, so connection recovery (which re-runs initialized lists'
|
|
5277
|
+
* queries) still skips such a list. Cleared by `resetState`.
|
|
5278
|
+
*/
|
|
5279
|
+
get hasLoadedPage() {
|
|
5280
|
+
return this._pageSetWithoutQuery || this.isInitialized;
|
|
5281
|
+
}
|
|
5268
5282
|
get isOfflineSupportEnabled() {
|
|
5269
5283
|
return false;
|
|
5270
5284
|
}
|
|
@@ -6723,6 +6737,7 @@ var BasePaginator = class {
|
|
|
6723
6737
|
newState.hasMoreHead = interval.hasMoreHead;
|
|
6724
6738
|
newState.hasMoreTail = interval.hasMoreTail;
|
|
6725
6739
|
}
|
|
6740
|
+
this._pageSetWithoutQuery = true;
|
|
6726
6741
|
return newState;
|
|
6727
6742
|
});
|
|
6728
6743
|
this.recordLoadedIntervalQueryShape();
|
|
@@ -7257,11 +7272,12 @@ var BasePaginator = class {
|
|
|
7257
7272
|
this._executeQueryDebounced.cancel();
|
|
7258
7273
|
}
|
|
7259
7274
|
resetState() {
|
|
7275
|
+
this._lastQueryShape = void 0;
|
|
7276
|
+
this._pageSetWithoutQuery = false;
|
|
7260
7277
|
this.state.next(this.initialState);
|
|
7261
7278
|
this.setIntervals([]);
|
|
7262
7279
|
this.setActiveInterval(void 0);
|
|
7263
7280
|
this.clearIntervalViews();
|
|
7264
|
-
this._lastQueryShape = void 0;
|
|
7265
7281
|
}
|
|
7266
7282
|
/**
|
|
7267
7283
|
* Releases this paginator's hold on its item content (unlinks every member ID from the shared
|
|
@@ -8543,16 +8559,22 @@ var MessageIntervalPaginator = class extends BasePaginator {
|
|
|
8543
8559
|
}
|
|
8544
8560
|
this.messageFocusSignal.next({ signal: null });
|
|
8545
8561
|
};
|
|
8562
|
+
/**
|
|
8563
|
+
* Deletes `userId`'s loaded messages (removes them on a hard delete) and marks the quotes of them
|
|
8564
|
+
* as deleted. Returns the messages it deleted, as they were before.
|
|
8565
|
+
*/
|
|
8546
8566
|
this.applyMessageDeletionForUser = ({
|
|
8547
8567
|
userId,
|
|
8548
8568
|
hardDelete = false,
|
|
8549
8569
|
deletedAt
|
|
8550
8570
|
}) => {
|
|
8551
8571
|
const loadedMessages = this._itemIndex.values();
|
|
8572
|
+
const deletedMessages = [];
|
|
8552
8573
|
this.batch(
|
|
8553
8574
|
() => {
|
|
8554
8575
|
for (const message of loadedMessages) {
|
|
8555
8576
|
if (message.user?.id === userId) {
|
|
8577
|
+
deletedMessages.push(message);
|
|
8556
8578
|
if (hardDelete) {
|
|
8557
8579
|
this.removeItem({ id: message.id });
|
|
8558
8580
|
} else {
|
|
@@ -8580,6 +8602,7 @@ var MessageIntervalPaginator = class extends BasePaginator {
|
|
|
8580
8602
|
},
|
|
8581
8603
|
{ coalesce: true }
|
|
8582
8604
|
);
|
|
8605
|
+
return deletedMessages;
|
|
8583
8606
|
};
|
|
8584
8607
|
/** Updates the quoted-message snapshot of every cached message that quotes `message`. */
|
|
8585
8608
|
this.reflectQuotedMessageUpdate = (message) => {
|
|
@@ -9635,6 +9658,8 @@ var MessagePaginator = class extends MessageIntervalPaginator {
|
|
|
9635
9658
|
stateThrottleMs: 500,
|
|
9636
9659
|
...builtInDefaults
|
|
9637
9660
|
});
|
|
9661
|
+
/** Whether `message` counts for {@link latestMessageAt}. */
|
|
9662
|
+
this.movesLastMessageAt = (message) => this.shouldAdvanceLatestMessage(message) && !this.isSkippedSystemMessage(message);
|
|
9638
9663
|
/**
|
|
9639
9664
|
* (Re)seeds the unread snapshot from the own read state. Runs once a first page and the rest of
|
|
9640
9665
|
* its response are in (the paginator's own first-page queries, `watch()` and the channel-list
|
|
@@ -9779,10 +9804,17 @@ var MessagePaginator = class extends MessageIntervalPaginator {
|
|
|
9779
9804
|
* {@link latestMessage}'s `created_at` and the `last_message_at` of the latest response (see
|
|
9780
9805
|
* {@link setQueriedLatestMessageAt}). Later than {@link latestMessage} when the server has newer
|
|
9781
9806
|
* messages the client does not hold. The channel-list sort key. **Derived** (never stored) so it
|
|
9782
|
-
* cannot drift from {@link latestMessage}.
|
|
9807
|
+
* cannot drift from {@link latestMessage}. A system message that does not move `last_message_at`
|
|
9808
|
+
* (see {@link isSkippedSystemMessage}) does not count: the newest loaded message that does is
|
|
9809
|
+
* used instead. `null` until a query sets it or a message is ingested.
|
|
9783
9810
|
*/
|
|
9784
9811
|
get latestMessageAt() {
|
|
9785
|
-
return this.latestMessageAtIncluding(this.
|
|
9812
|
+
return this.latestMessageAtIncluding(this.latestMessageAtSource);
|
|
9813
|
+
}
|
|
9814
|
+
/** The newest loaded message that moves `last_message_at`, which {@link latestMessageAt} reads. */
|
|
9815
|
+
get latestMessageAtSource() {
|
|
9816
|
+
const { latestMessage } = this.aggregateState.getLatestValue();
|
|
9817
|
+
return this.isSkippedSystemMessage(latestMessage) ? this.recomputeLatestMessage({ counts: this.movesLastMessageAt }) : latestMessage;
|
|
9786
9818
|
}
|
|
9787
9819
|
/**
|
|
9788
9820
|
* {@link latestMessageAt} as the server knows it (see {@link pageReachesHead}): an unsent latest
|
|
@@ -9792,7 +9824,10 @@ var MessagePaginator = class extends MessageIntervalPaginator {
|
|
|
9792
9824
|
const { latestMessage } = this.aggregateState.getLatestValue();
|
|
9793
9825
|
const isUnsent = !!latestMessage && !this.isServerConfirmedMessage(latestMessage);
|
|
9794
9826
|
return this.latestMessageAtIncluding(
|
|
9795
|
-
isUnsent ? this.recomputeLatestMessage({
|
|
9827
|
+
isUnsent || this.isSkippedSystemMessage(latestMessage) ? this.recomputeLatestMessage({
|
|
9828
|
+
counts: this.movesLastMessageAt,
|
|
9829
|
+
serverConfirmedOnly: true
|
|
9830
|
+
}) : latestMessage
|
|
9796
9831
|
);
|
|
9797
9832
|
}
|
|
9798
9833
|
/** The later of `message`'s `created_at` and the queried `last_message_at`. */
|
|
@@ -9814,8 +9849,8 @@ var MessagePaginator = class extends MessageIntervalPaginator {
|
|
|
9814
9849
|
*
|
|
9815
9850
|
* It differs from {@link anchoredHeadItem}, the newest message of the interval known to reach the
|
|
9816
9851
|
* server's latest message, in two ways:
|
|
9817
|
-
* - It skips messages that do not count
|
|
9818
|
-
* `
|
|
9852
|
+
* - It skips messages that do not count: an `error` message can be `anchoredHeadItem` but never
|
|
9853
|
+
* `latestMessage`.
|
|
9819
9854
|
* - It does not need that interval. A channel opened at its first unread message loads m40–m60
|
|
9820
9855
|
* while the server's newest is m95: `latestMessage` is m60, `latestMessageAt` is m95's time and
|
|
9821
9856
|
* `anchoredHeadItem` is `undefined`.
|
|
@@ -9836,17 +9871,24 @@ var MessagePaginator = class extends MessageIntervalPaginator {
|
|
|
9836
9871
|
return head ? this.getServerKnownEdges(head).head : void 0;
|
|
9837
9872
|
}
|
|
9838
9873
|
/**
|
|
9839
|
-
* Whether `message` counts as the channel's latest message: not shadowed
|
|
9840
|
-
*
|
|
9841
|
-
*
|
|
9842
|
-
* thread replies, so
|
|
9874
|
+
* Whether `message` counts as the channel's latest message: not shadowed, not an `error` or
|
|
9875
|
+
* `ephemeral` message (only the current user sees those, e.g. a failed command or a giphy preview)
|
|
9876
|
+
* and, in the main list, not a thread-only reply. A reply list (`parentMessageId` set) holds only
|
|
9877
|
+
* thread replies, so the thread-only rule does not apply there.
|
|
9843
9878
|
*/
|
|
9844
9879
|
shouldAdvanceLatestMessage(message) {
|
|
9845
9880
|
if (message.shadowed) return false;
|
|
9881
|
+
if (message.type === "error" || message.type === "ephemeral") return false;
|
|
9846
9882
|
if (this.parentMessageId) return true;
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9883
|
+
return !isThreadOnlyReply(message);
|
|
9884
|
+
}
|
|
9885
|
+
/**
|
|
9886
|
+
* Whether `message` is a main-list system message that, with
|
|
9887
|
+
* `skip_last_msg_update_for_system_msgs`, does not move the channel's `last_message_at` on the
|
|
9888
|
+
* server. It is still shown as the {@link latestMessage}, but {@link latestMessageAt} skips it.
|
|
9889
|
+
*/
|
|
9890
|
+
isSkippedSystemMessage(message) {
|
|
9891
|
+
return !!message && !this.parentMessageId && message.type === "system" && !!this.channel.serverConfig?.skip_last_msg_update_for_system_msgs;
|
|
9850
9892
|
}
|
|
9851
9893
|
/**
|
|
9852
9894
|
* Advances {@link latestMessage} (and so {@link latestMessageAt}) to `message` when it is newer
|
|
@@ -9855,10 +9897,16 @@ var MessagePaginator = class extends MessageIntervalPaginator {
|
|
|
9855
9897
|
* for callers that advance it without an in-interval ingest, e.g. offline pending-message replay.
|
|
9856
9898
|
*/
|
|
9857
9899
|
trackLatestMessage(message) {
|
|
9858
|
-
|
|
9900
|
+
const current = this.aggregateState.getLatestValue().latestMessage;
|
|
9901
|
+
if (!this.shouldAdvanceLatestMessage(message)) {
|
|
9902
|
+
if (current?.id !== message.id) return false;
|
|
9903
|
+
this.aggregateState.partialNext({
|
|
9904
|
+
latestMessage: this.recomputeLatestMessage({ excludeId: message.id })
|
|
9905
|
+
});
|
|
9906
|
+
return true;
|
|
9907
|
+
}
|
|
9859
9908
|
const incoming = getMessageCreatedAtTimestamp(message);
|
|
9860
9909
|
if (incoming === null) return false;
|
|
9861
|
-
const current = this.aggregateState.getLatestValue().latestMessage;
|
|
9862
9910
|
if (current && current.id === message.id) {
|
|
9863
9911
|
this.aggregateState.partialNext({ latestMessage: message });
|
|
9864
9912
|
return true;
|
|
@@ -10052,7 +10100,10 @@ var MessagePaginator = class extends MessageIntervalPaginator {
|
|
|
10052
10100
|
const { latestMessage } = this.aggregateState.getLatestValue();
|
|
10053
10101
|
if (!latestMessage || !batch.changedIds.has(latestMessage.id)) return;
|
|
10054
10102
|
const stored = this.getItem(latestMessage.id);
|
|
10055
|
-
if (stored)
|
|
10103
|
+
if (!stored) return;
|
|
10104
|
+
this.aggregateState.partialNext({
|
|
10105
|
+
latestMessage: this.shouldAdvanceLatestMessage(stored) ? stored : this.recomputeLatestMessage({ excludeId: stored.id })
|
|
10106
|
+
});
|
|
10056
10107
|
}
|
|
10057
10108
|
reflectUserUpdate(user) {
|
|
10058
10109
|
super.reflectUserUpdate(user);
|
|
@@ -10064,17 +10115,19 @@ var MessagePaginator = class extends MessageIntervalPaginator {
|
|
|
10064
10115
|
const removedId = params.id ?? (params.item ? this.getItemId(params.item) : void 0);
|
|
10065
10116
|
const { latestMessage, queriedLatestMessageAt } = this.aggregateState.getLatestValue();
|
|
10066
10117
|
const wasLatest = !!removedId && latestMessage?.id === removedId;
|
|
10118
|
+
const latestMessageAtSource = removedId ? this.latestMessageAtSource : null;
|
|
10119
|
+
const wasLatestMessageAtSource = !!removedId && latestMessageAtSource?.id === removedId;
|
|
10067
10120
|
const result = super.removeItem(params);
|
|
10068
|
-
if (wasLatest)
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
}
|
|
10121
|
+
if (!wasLatest && !wasLatestMessageAtSource) return result;
|
|
10122
|
+
const previousAt = wasLatestMessageAtSource ? getMessageCreatedAtTimestamp(
|
|
10123
|
+
this.recomputeLatestMessage({ counts: this.movesLastMessageAt })
|
|
10124
|
+
) : null;
|
|
10125
|
+
const removedAt = getMessageCreatedAtTimestamp(latestMessageAtSource);
|
|
10126
|
+
const isQueriedFromRemovedMessage = wasLatestMessageAtSource && queriedLatestMessageAt !== null && removedAt !== null && queriedLatestMessageAt <= removedAt;
|
|
10127
|
+
this.aggregateState.partialNext({
|
|
10128
|
+
latestMessage: wasLatest ? this.recomputeLatestMessage() : latestMessage,
|
|
10129
|
+
queriedLatestMessageAt: isQueriedFromRemovedMessage && previousAt !== null ? previousAt : queriedLatestMessageAt
|
|
10130
|
+
});
|
|
10078
10131
|
return result;
|
|
10079
10132
|
}
|
|
10080
10133
|
truncate(params) {
|
|
@@ -10092,15 +10145,18 @@ var MessagePaginator = class extends MessageIntervalPaginator {
|
|
|
10092
10145
|
});
|
|
10093
10146
|
}
|
|
10094
10147
|
/**
|
|
10095
|
-
* The still-loaded message with the greatest `created_at` that
|
|
10096
|
-
* {@link shouldAdvanceLatestMessage}
|
|
10097
|
-
*
|
|
10098
|
-
*
|
|
10099
|
-
*
|
|
10100
|
-
*
|
|
10101
|
-
* It compares timestamps rather than positions, so it holds for any
|
|
10148
|
+
* The still-loaded message with the greatest `created_at` that `counts` (by default
|
|
10149
|
+
* {@link shouldAdvanceLatestMessage}), from the interval that reaches the newest message and the
|
|
10150
|
+
* {@link logicalHeadItemsSinceQueriedLatestMessageAt}. An interval reached by a jump is not
|
|
10151
|
+
* searched, nor an out-of-order older message: neither is the channel's previous message. Used to
|
|
10152
|
+
* recompute the tracked latest after the current one is removed or stops counting;
|
|
10153
|
+
* `serverConfirmedOnly` skips unsent messages and `excludeId` skips that message. `null` when
|
|
10154
|
+
* nothing loaded qualifies. It compares timestamps rather than positions, so it holds for any
|
|
10155
|
+
* `itemOrder` / `requestSort`.
|
|
10102
10156
|
*/
|
|
10103
10157
|
recomputeLatestMessage({
|
|
10158
|
+
counts = (message) => this.shouldAdvanceLatestMessage(message),
|
|
10159
|
+
excludeId,
|
|
10104
10160
|
serverConfirmedOnly = false
|
|
10105
10161
|
} = {}) {
|
|
10106
10162
|
let latest = null;
|
|
@@ -10109,7 +10165,7 @@ var MessagePaginator = class extends MessageIntervalPaginator {
|
|
|
10109
10165
|
...this.anchoredHeadItems,
|
|
10110
10166
|
...this.logicalHeadItemsSinceQueriedLatestMessageAt
|
|
10111
10167
|
]) {
|
|
10112
|
-
if (!
|
|
10168
|
+
if (item.id === excludeId || !counts(item)) continue;
|
|
10113
10169
|
if (serverConfirmedOnly && !this.isServerConfirmedMessage(item)) continue;
|
|
10114
10170
|
const timestamp = getMessageCreatedAtTimestamp(item);
|
|
10115
10171
|
if (timestamp === null || timestamp <= latestTimestamp) continue;
|
|
@@ -11341,12 +11397,14 @@ var createLinkPreviewsCompositionMiddleware = (composer) => ({
|
|
|
11341
11397
|
linkPreviews
|
|
11342
11398
|
);
|
|
11343
11399
|
const localAttachments = (state.localMessage.attachments ?? []).concat(linkPreviews);
|
|
11344
|
-
if (!messageAttachments.length && !localAttachments.length) return forward();
|
|
11345
11400
|
const sendOptions = { ...state.sendOptions };
|
|
11346
11401
|
const skip_enrich_url = !someLinkPreviewsLoading && linkPreviews.length > 0 || someLinkPreviewsDismissed;
|
|
11347
11402
|
if (skip_enrich_url) {
|
|
11348
11403
|
sendOptions.skip_enrich_url = true;
|
|
11349
11404
|
}
|
|
11405
|
+
if (!messageAttachments.length && !localAttachments.length) {
|
|
11406
|
+
return skip_enrich_url ? next({ ...state, sendOptions }) : forward();
|
|
11407
|
+
}
|
|
11350
11408
|
return next({
|
|
11351
11409
|
...state,
|
|
11352
11410
|
message: messageAttachments.length ? {
|
|
@@ -16873,6 +16931,24 @@ var Channel = class extends ChannelApi {
|
|
|
16873
16931
|
const paginator = this.messagePaginator;
|
|
16874
16932
|
return paginator.anchoredHeadItem !== void 0 ? paginator.anchoredHeadItems : paginator.logicalHeadItems;
|
|
16875
16933
|
}
|
|
16934
|
+
/**
|
|
16935
|
+
* Lowers the own unread count by the unread ones among `deletedMessages`, as they were before the
|
|
16936
|
+
* delete. The server lowers it for every unread message deleted, except in a soft bulk delete
|
|
16937
|
+
* (`user.messages.deleted`), and does not send the new count. Unread messages that are not loaded
|
|
16938
|
+
* cannot be counted; the next query brings the server's count.
|
|
16939
|
+
*
|
|
16940
|
+
* @internal
|
|
16941
|
+
*/
|
|
16942
|
+
_lowerUnreadCountForDeletedMessages(deletedMessages) {
|
|
16943
|
+
const lastRead = this.lastRead();
|
|
16944
|
+
if (lastRead == null || this.state.unreadCount === 0) return;
|
|
16945
|
+
const deletedUnread = deletedMessages.filter(
|
|
16946
|
+
(message) => message.type !== "deleted" && message.created_at > lastRead && this._countMessageAsUnread(message)
|
|
16947
|
+
).length;
|
|
16948
|
+
if (deletedUnread > 0) {
|
|
16949
|
+
this._setOwnUnreadCount(Math.max(0, this.state.unreadCount - deletedUnread));
|
|
16950
|
+
}
|
|
16951
|
+
}
|
|
16876
16952
|
/**
|
|
16877
16953
|
* Counts the unread messages that mention the current user, within the channel's newest messages
|
|
16878
16954
|
* that are loaded (see {@link newestKnownMessages}).
|
|
@@ -17356,6 +17432,8 @@ var Channel = class extends ChannelApi {
|
|
|
17356
17432
|
if (event.message) {
|
|
17357
17433
|
this._extendEventWithOwnReactions(event);
|
|
17358
17434
|
const formattedMessage = formatMessage(event.message);
|
|
17435
|
+
const deletedMessage = this.getClient().messageStore.get(event.message.id);
|
|
17436
|
+
if (deletedMessage) this._lowerUnreadCountForDeletedMessages([deletedMessage]);
|
|
17359
17437
|
if (!isThreadOnlyReply(event.message)) {
|
|
17360
17438
|
if (event.hard_delete) {
|
|
17361
17439
|
this.messagePaginator.removeItem({ id: event.message.id });
|
|
@@ -17373,11 +17451,12 @@ var Channel = class extends ChannelApi {
|
|
|
17373
17451
|
if (event.user) {
|
|
17374
17452
|
const deletedAt = event.created_at ?? nowNs();
|
|
17375
17453
|
const hardDelete = !!event.hard_delete;
|
|
17376
|
-
this.messagePaginator.applyMessageDeletionForUser({
|
|
17454
|
+
const deletedMessages = this.messagePaginator.applyMessageDeletionForUser({
|
|
17377
17455
|
userId: event.user.id,
|
|
17378
17456
|
hardDelete,
|
|
17379
17457
|
deletedAt
|
|
17380
17458
|
});
|
|
17459
|
+
if (hardDelete) this._lowerUnreadCountForDeletedMessages(deletedMessages);
|
|
17381
17460
|
this.pinnedMessagesPaginator.applyMessageDeletionForUser({
|
|
17382
17461
|
userId: event.user.id,
|
|
17383
17462
|
hardDelete,
|
|
@@ -17523,6 +17602,14 @@ var Channel = class extends ChannelApi {
|
|
|
17523
17602
|
if (removedUserId === this.getClient().userId) {
|
|
17524
17603
|
channelState.membership = {};
|
|
17525
17604
|
}
|
|
17605
|
+
this._patchReadState(
|
|
17606
|
+
(currentReadState) => {
|
|
17607
|
+
if (!currentReadState[removedUserId]) return currentReadState;
|
|
17608
|
+
const { [removedUserId]: _removed, ...nextReadState } = currentReadState;
|
|
17609
|
+
return nextReadState;
|
|
17610
|
+
},
|
|
17611
|
+
{ removedUserIds: [removedUserId] }
|
|
17612
|
+
);
|
|
17526
17613
|
}
|
|
17527
17614
|
break;
|
|
17528
17615
|
}
|
|
@@ -25100,11 +25187,12 @@ var StreamChat = class _StreamChat extends ChatApi {
|
|
|
25100
25187
|
this._deleteUserMessageReference = (user, hardDelete = false, deletedAt) => {
|
|
25101
25188
|
for (const channel of this.channelManager.values()) {
|
|
25102
25189
|
if (channel) {
|
|
25103
|
-
channel.messagePaginator.applyMessageDeletionForUser({
|
|
25190
|
+
const deletedMessages = channel.messagePaginator.applyMessageDeletionForUser({
|
|
25104
25191
|
userId: user.id,
|
|
25105
25192
|
hardDelete,
|
|
25106
25193
|
deletedAt: deletedAt ?? nowNs()
|
|
25107
25194
|
});
|
|
25195
|
+
if (hardDelete) channel._lowerUnreadCountForDeletedMessages(deletedMessages);
|
|
25108
25196
|
channel.pinnedMessagesPaginator.applyMessageDeletionForUser({
|
|
25109
25197
|
userId: user.id,
|
|
25110
25198
|
hardDelete,
|
|
@@ -25186,7 +25274,7 @@ var StreamChat = class _StreamChat extends ChatApi {
|
|
|
25186
25274
|
return this.userAgent;
|
|
25187
25275
|
}
|
|
25188
25276
|
if (!this.cachedUserAgent) {
|
|
25189
|
-
const version = "10.0.0-rc.
|
|
25277
|
+
const version = "10.0.0-rc.34";
|
|
25190
25278
|
const { name: sdkName, version: sdkVersion } = this.sdkIdentifier ?? {};
|
|
25191
25279
|
const { name: appName, version: appVersion } = this.appIdentifier ?? {};
|
|
25192
25280
|
const { os, model: deviceModel } = this.deviceIdentifier ?? {};
|
|
@@ -25445,10 +25533,18 @@ var StreamChat = class _StreamChat extends ChatApi {
|
|
|
25445
25533
|
* second argument, as on the generated methods; pass `undefined`.
|
|
25446
25534
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
25447
25535
|
* into the request (optional).
|
|
25448
|
-
* @returns The application settings response.
|
|
25536
|
+
* @returns The application settings response. A failed request is not kept in
|
|
25537
|
+
* {@link appSettingsPromise}, so the next call fetches again.
|
|
25449
25538
|
*/
|
|
25450
25539
|
async getAppSettings(_request, requestOptions) {
|
|
25451
|
-
|
|
25540
|
+
const promise = this.getApp(void 0, requestOptions);
|
|
25541
|
+
this.appSettingsPromise = promise;
|
|
25542
|
+
try {
|
|
25543
|
+
return await promise;
|
|
25544
|
+
} catch (error) {
|
|
25545
|
+
if (this.appSettingsPromise === promise) this.appSettingsPromise = void 0;
|
|
25546
|
+
throw error;
|
|
25547
|
+
}
|
|
25452
25548
|
}
|
|
25453
25549
|
/**
|
|
25454
25550
|
* Creates a guest user.
|