diff --git a/lib/hooks/user-identities-hooks.js b/lib/hooks/user-identities-hooks.js index e7495276e..ddbf39f59 100644 --- a/lib/hooks/user-identities-hooks.js +++ b/lib/hooks/user-identities-hooks.js @@ -1,41 +1,40 @@ // @flow import * as React from 'react'; import { useFindUserIdentities } from '../actions/find-user-identities-actions.js'; -import { userHasDeviceList } from '../shared/thread-utils.js'; import { useSelector } from '../utils/redux-utils.js'; function useUsersSupportThickThreads(): ( userIDs: $ReadOnlyArray, ) => Promise<$ReadOnlySet> { const findUserIdentities = useFindUserIdentities(); const auxUserInfos = useSelector(state => state.auxUserStore.auxUserInfos); return React.useCallback( async (userIDs: $ReadOnlyArray) => { const usersSupportingThickThreads = new Set(); const usersNeedingFetch = []; for (const userID of userIDs) { - if (userHasDeviceList(userID, auxUserInfos)) { + if (auxUserInfos[userID]?.deviceList) { usersSupportingThickThreads.add(userID); } else { usersNeedingFetch.push(userID); } } if (usersNeedingFetch.length > 0) { const { identities } = await findUserIdentities(usersNeedingFetch); for (const userID of usersNeedingFetch) { if (identities[userID]) { usersSupportingThickThreads.add(userID); } } } return usersSupportingThickThreads; }, [auxUserInfos, findUserIdentities], ); } export { useUsersSupportThickThreads };