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,10 +2,16 @@ import * as React from 'react'; +import { + updateRelationships, + updateRelationshipsActionTypes, +} from '../actions/relationship-actions.js'; import { useFindUserIdentities, findUserIdentitiesActionTypes, } from '../actions/user-actions.js'; +import { useLegacyAshoatKeyserverCall } from '../keyserver-conn/legacy-keyserver-call.js'; +import { relationshipActions } from '../types/relationship-types.js'; import { useDispatchActionPromise } from '../utils/redux-promise-utils.js'; import { useSelector } from '../utils/redux-utils.js'; import { @@ -28,6 +34,9 @@ const requestedIDsRef = React.useRef(new Set()); + const callUpdateRelationships = + useLegacyAshoatKeyserverCall(updateRelationships); + React.useEffect(() => { const newUserIDs = Object.keys(userInfosWithMissingUsernames).filter( id => !requestedIDsRef.current.has(id), @@ -35,16 +44,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 = []; @@ -57,7 +60,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,