Page MenuHomePhabricator

D13729.id45273.diff
No OneTemporary

D13729.id45273.diff

diff --git a/lib/shared/dm-ops/dm-op-utils.js b/lib/shared/dm-ops/dm-op-utils.js
--- a/lib/shared/dm-ops/dm-op-utils.js
+++ b/lib/shared/dm-ops/dm-op-utils.js
@@ -47,7 +47,10 @@
import { getContentSigningKey } from '../../utils/crypto-utils.js';
import { useSelector, useDispatch } from '../../utils/redux-utils.js';
import { messageSpecs } from '../messages/message-specs.js';
-import { userHasDeviceList } from '../thread-utils.js';
+import {
+ userHasDeviceList,
+ deviceListCanBeRequestedForUser,
+} from '../thread-utils.js';
function generateMessagesToPeers(
message: DMOperation,
@@ -135,7 +138,11 @@
const missingDeviceListsUserIDs: Array<string> = [];
for (const userID of userIDs) {
const supportsThickThreads = userHasDeviceList(userID, auxUserInfos);
- if (!supportsThickThreads) {
+ const deviceListCanBeRequested = deviceListCanBeRequestedForUser(
+ userID,
+ auxUserInfos,
+ );
+ if (!supportsThickThreads && deviceListCanBeRequested) {
missingDeviceListsUserIDs.push(userID);
}
}
diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js
--- a/lib/shared/thread-utils.js
+++ b/lib/shared/thread-utils.js
@@ -1832,6 +1832,19 @@
return !!deviceList && deviceList.devices.length > 0;
}
+const deviceListRequestTimeout = 20 * 1000; // twenty seconds
+
+function deviceListCanBeRequestedForUser(
+ userID: string,
+ auxUserInfos: AuxUserInfos,
+): boolean {
+ return (
+ !auxUserInfos[userID]?.accountMissingStatus ||
+ auxUserInfos[userID].accountMissingStatus.lastChecked <
+ Date.now() - deviceListRequestTimeout
+ );
+}
+
export {
threadHasPermission,
useCommunityRootMembersToRole,
@@ -1901,4 +1914,5 @@
createThreadTimestamps,
userHasDeviceList,
deviceListIsNonEmpty,
+ deviceListCanBeRequestedForUser,
};

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 18, 7:33 PM (21 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2535757
Default Alt Text
D13729.id45273.diff (1 KB)

Event Timeline