Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32222578
D13729.1765203928.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D13729.1765203928.diff
View Options
diff --git a/lib/hooks/user-identities-hooks.js b/lib/hooks/user-identities-hooks.js
--- a/lib/hooks/user-identities-hooks.js
+++ b/lib/hooks/user-identities-hooks.js
@@ -3,7 +3,10 @@
import * as React from 'react';
import { useFindUserIdentities } from '../actions/find-user-identities-actions.js';
-import { userHasDeviceList } from '../shared/thread-utils.js';
+import {
+ userHasDeviceList,
+ deviceListCanBeRequestedForUser,
+} from '../shared/thread-utils.js';
import { useSelector } from '../utils/redux-utils.js';
function useUsersSupportThickThreads(): (
@@ -20,7 +23,7 @@
for (const userID of userIDs) {
if (userHasDeviceList(userID, auxUserInfos)) {
usersSupportingThickThreads.add(userID);
- } else {
+ } else if (deviceListCanBeRequestedForUser(userID, auxUserInfos)) {
usersNeedingFetch.push(userID);
}
}
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,11 @@
import { getContentSigningKey } from '../../utils/crypto-utils.js';
import { useSelector, useDispatch } from '../../utils/redux-utils.js';
import { messageSpecs } from '../messages/message-specs.js';
-import { userHasDeviceList, deviceListIsNonEmpty } from '../thread-utils.js';
+import {
+ userHasDeviceList,
+ deviceListIsNonEmpty,
+ deviceListCanBeRequestedForUser,
+} from '../thread-utils.js';
function generateMessagesToPeers(
message: DMOperation,
@@ -135,7 +139,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, Dec 8, 2:25 PM (7 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5848683
Default Alt Text
D13729.1765203928.diff (2 KB)
Attached To
Mode
D13729: [lib] Update usages of userHasDeviceList to acknowledge accountMissingStatus
Attached
Detach File
Event Timeline
Log In to Comment