Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3300551
D13729.id45273.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D13729.id45273.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D13729: [lib] Update usages of userHasDeviceList to acknowledge accountMissingStatus
Attached
Detach File
Event Timeline
Log In to Comment