diff --git a/lib/handlers/user-infos-handler.react.js b/lib/handlers/user-infos-handler.react.js --- a/lib/handlers/user-infos-handler.react.js +++ b/lib/handlers/user-infos-handler.react.js @@ -2,13 +2,19 @@ import * as React from 'react'; +import { + updateRelationships, + updateRelationshipsActionTypes, +} from '../actions/relationship-actions.js'; import { useFindUserIdentities, findUserIdentitiesActionTypes, } from '../actions/user-actions.js'; import { useGetAndUpdateDeviceListsForUsers } from '../hooks/peer-list-hooks.js'; +import { useLegacyAshoatKeyserverCall } from '../keyserver-conn/legacy-keyserver-call.js'; import { usersWithMissingDeviceListSelector } from '../selectors/user-selectors.js'; import { useTunnelbroker } from '../tunnelbroker/tunnelbroker-context.js'; +import { relationshipActions } from '../types/relationship-types.js'; import { getMessageForException } from '../utils/errors.js'; import { useDispatchActionPromise } from '../utils/redux-promise-utils.js'; import { useSelector } from '../utils/redux-utils.js'; @@ -32,6 +38,9 @@ const requestedIDsRef = React.useRef(new Set()); + const callUpdateRelationships = + useLegacyAshoatKeyserverCall(updateRelationships); + React.useEffect(() => { const newUserIDs = Object.keys(userInfosWithMissingUsernames).filter( id => !requestedIDsRef.current.has(id), @@ -39,16 +48,10 @@ if (!usingCommServicesAccessToken || newUserIDs.length === 0) { return; } - + // 1. Fetch usernames from identity const promise = (async () => { newUserIDs.forEach(id => requestedIDsRef.current.add(id)); - // 1. Fetch usernames from identity const identities = await findUserIdentities(newUserIDs); - - // 2. Fetch avatars and settings from auth keyserver - if (relyingOnAuthoritativeKeyserver) { - // TODO - } newUserIDs.forEach(id => requestedIDsRef.current.delete(id)); const newUserInfos = []; @@ -61,7 +64,18 @@ return { userInfos: newUserInfos }; })(); void dispatchActionPromise(findUserIdentitiesActionTypes, promise); + // 2. Fetch avatars from auth keyserver + if (relyingOnAuthoritativeKeyserver) { + void dispatchActionPromise( + updateRelationshipsActionTypes, + callUpdateRelationships({ + action: relationshipActions.ACKNOWLEDGE, + userIDs: newUserIDs, + }), + ); + } }, [ + callUpdateRelationships, dispatchActionPromise, findUserIdentities, userInfos,