Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33311253
D14023.1768810461.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D14023.1768810461.diff
View Options
diff --git a/lib/hooks/relationship-hooks.js b/lib/hooks/relationship-hooks.js
--- a/lib/hooks/relationship-hooks.js
+++ b/lib/hooks/relationship-hooks.js
@@ -87,7 +87,7 @@
);
const createNewThickThread = useNewThickThread();
- const filterUsersSupportingThickThreads = useUsersSupportThickThreads();
+ const mapUsersSupportingThickThreads = useUsersSupportThickThreads();
const updateRelationshipsAndSendRobotext = React.useCallback(
async (action: RelationshipAction, userIDs: $ReadOnlyArray<string>) => {
@@ -98,10 +98,13 @@
return {};
}
const usersSupportingThickThreads =
- await filterUsersSupportingThickThreads(userIDs);
+ await mapUsersSupportingThickThreads(userIDs);
const planForUsers = new Map<string, RobotextPlanForUser>();
for (const userID of userIDs) {
- if (!usersSupportingThickThreads.has(userID)) {
+ if (usersSupportingThickThreads.get(userID) === undefined) {
+ throw new Error('Cannot fetch user identity');
+ }
+ if (!usersSupportingThickThreads.get(userID)) {
planForUsers.set(userID, { plan: 'send_to_thin_thread' });
continue;
}
@@ -220,7 +223,7 @@
[
viewerID,
updateRelationships,
- filterUsersSupportingThickThreads,
+ mapUsersSupportingThickThreads,
pendingToRealizedThreadIDs,
sendRobotextToThickThread,
userInfos,
diff --git a/lib/hooks/thread-search-hooks.js b/lib/hooks/thread-search-hooks.js
--- a/lib/hooks/thread-search-hooks.js
+++ b/lib/hooks/thread-search-hooks.js
@@ -106,7 +106,7 @@
filterAndSetUserResults(
identitySearchUsers.map(search => ({
...search,
- supportThickThreads: userIDsSupportingThickThreads.has(search.id),
+ supportThickThreads: !!userIDsSupportingThickThreads.get(search.id),
})),
);
})();
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
@@ -7,18 +7,18 @@
function useUsersSupportThickThreads(): (
userIDs: $ReadOnlyArray<string>,
-) => Promise<$ReadOnlySet<string>> {
+) => Promise<$ReadOnlyMap<string, boolean | void>> {
const findUserIdentities = useFindUserIdentities();
const auxUserInfos = useSelector(state => state.auxUserStore.auxUserInfos);
return React.useCallback(
async (userIDs: $ReadOnlyArray<string>) => {
- const usersSupportingThickThreads = new Set<string>();
+ const usersSupportingThickThreads = new Map<string, boolean | void>();
const usersNeedingFetch = [];
for (const userID of userIDs) {
if (auxUserInfos[userID]?.deviceList) {
- usersSupportingThickThreads.add(userID);
+ usersSupportingThickThreads.set(userID, true);
} else {
usersNeedingFetch.push(userID);
}
@@ -27,7 +27,11 @@
const { identities } = await findUserIdentities(usersNeedingFetch);
for (const userID of usersNeedingFetch) {
if (identities[userID]) {
- usersSupportingThickThreads.add(userID);
+ usersSupportingThickThreads.set(userID, true);
+ } else if (identities[userID] === undefined) {
+ usersSupportingThickThreads.set(userID, undefined);
+ } else {
+ usersSupportingThickThreads.set(userID, false);
}
}
}
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
@@ -1790,7 +1790,7 @@
return;
}
const result = await usersSupportThickThreads([userInfo.id]);
- setSupportThickThreads(result.has(userInfo.id));
+ setSupportThickThreads(!!result.get(userInfo.id));
})();
}, [userInfo, usersSupportThickThreads]);
diff --git a/native/chat/message-list-container.react.js b/native/chat/message-list-container.react.js
--- a/native/chat/message-list-container.react.js
+++ b/native/chat/message-list-container.react.js
@@ -299,7 +299,7 @@
);
setAllUsersSupportThickThreads(
userInfoInputArray.every(userInfo =>
- usersSupportingThickThreads.has(userInfo.id),
+ usersSupportingThickThreads.get(userInfo.id),
),
);
})();
diff --git a/web/chat/chat-thread-composer.react.js b/web/chat/chat-thread-composer.react.js
--- a/web/chat/chat-thread-composer.react.js
+++ b/web/chat/chat-thread-composer.react.js
@@ -115,7 +115,7 @@
allUsersSupportThickThreads:
user.id === viewerID
? true
- : usersSupportingThickThreads.has(user.id),
+ : !!usersSupportingThickThreads.get(user.id),
});
dispatch({
type: updateNavInfoActionType,
diff --git a/web/utils/thread-utils.js b/web/utils/thread-utils.js
--- a/web/utils/thread-utils.js
+++ b/web/utils/thread-utils.js
@@ -88,7 +88,7 @@
);
setAllUsersSupportThickThreads(
selectedUserInfos.every(userInfo =>
- usersSupportingThickThreads.has(userInfo.id),
+ usersSupportingThickThreads.get(userInfo.id),
),
);
})();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 19, 8:14 AM (14 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5955373
Default Alt Text
D14023.1768810461.diff (5 KB)
Attached To
Mode
D14023: [lib] Don't created thin thread if call to identity server failed when adding friends
Attached
Detach File
Event Timeline
Log In to Comment