diff --git a/keyserver/src/responders/relationship-responders.js b/keyserver/src/responders/relationship-responders.js --- a/keyserver/src/responders/relationship-responders.js +++ b/keyserver/src/responders/relationship-responders.js @@ -3,7 +3,7 @@ import t, { type TInterface } from 'tcomb'; import { - type RelationshipRequest, + type TraditionalRelationshipRequest, type RelationshipErrors, relationshipActionsList, } from 'lib/types/relationship-types.js'; @@ -12,8 +12,8 @@ import type { Viewer } from '../session/viewer.js'; import { updateRelationships } from '../updaters/relationship-updaters.js'; -export const updateRelationshipInputValidator: TInterface = - tShape({ +export const updateRelationshipInputValidator: TInterface = + tShape({ action: t.enums.of(relationshipActionsList, 'relationship action'), userIDs: t.list(t.String), }); @@ -27,7 +27,7 @@ async function updateRelationshipsResponder( viewer: Viewer, - request: RelationshipRequest, + request: TraditionalRelationshipRequest, ): Promise { return await updateRelationships(viewer, request); } diff --git a/keyserver/src/updaters/relationship-updaters.js b/keyserver/src/updaters/relationship-updaters.js --- a/keyserver/src/updaters/relationship-updaters.js +++ b/keyserver/src/updaters/relationship-updaters.js @@ -5,7 +5,7 @@ import { sortUserIDs } from 'lib/shared/relationship-utils.js'; import { messageTypes } from 'lib/types/message-types-enum.js'; import { - type RelationshipRequest, + type TraditionalRelationshipRequest, type RelationshipErrors, type UndirectedRelationshipRow, relationshipActions, @@ -30,7 +30,7 @@ async function updateRelationships( viewer: Viewer, - request: RelationshipRequest, + request: TraditionalRelationshipRequest, ): Promise { const { action } = request; @@ -323,7 +323,7 @@ async function createPersonalThreads( viewer: Viewer, - request: RelationshipRequest, + request: TraditionalRelationshipRequest, ) { invariant( request.action === relationshipActions.FRIEND || diff --git a/lib/actions/relationship-actions.js b/lib/actions/relationship-actions.js --- a/lib/actions/relationship-actions.js +++ b/lib/actions/relationship-actions.js @@ -1,7 +1,7 @@ // @flow import type { - RelationshipRequest, + TraditionalRelationshipRequest, RelationshipErrors, } from '../types/relationship-types.js'; import type { CallSingleKeyserverEndpoint } from '../utils/call-single-keyserver-endpoint.js'; @@ -15,7 +15,9 @@ const updateRelationships = ( callSingleKeyserverEndpoint: CallSingleKeyserverEndpoint, - ): ((request: RelationshipRequest) => Promise) => + ): (( + request: TraditionalRelationshipRequest, + ) => Promise) => async request => { const errors = await callSingleKeyserverEndpoint( 'update_relationships', diff --git a/lib/types/relationship-types.js b/lib/types/relationship-types.js --- a/lib/types/relationship-types.js +++ b/lib/types/relationship-types.js @@ -67,7 +67,7 @@ }); export type RelationshipButton = $Values; -export type RelationshipRequest = { +export type TraditionalRelationshipRequest = { +action: RelationshipAction, +userIDs: $ReadOnlyArray, }; diff --git a/native/profile/relationship-list-item.react.js b/native/profile/relationship-list-item.react.js --- a/native/profile/relationship-list-item.react.js +++ b/native/profile/relationship-list-item.react.js @@ -12,7 +12,7 @@ import type { LoadingStatus } from 'lib/types/loading-types.js'; import type { ReactRef } from 'lib/types/react-types.js'; import { - type RelationshipRequest, + type TraditionalRelationshipRequest, type RelationshipAction, type RelationshipErrors, userRelationshipStatus, @@ -111,7 +111,7 @@ +dispatchActionPromise: DispatchActionPromise, // async functions that hit server APIs +updateRelationships: ( - request: RelationshipRequest, + request: TraditionalRelationshipRequest, ) => Promise, // withOverlayContext +overlayContext: ?OverlayContextType,