diff --git a/keyserver/src/creators/thread-creator.js b/keyserver/src/creators/thread-creator.js --- a/keyserver/src/creators/thread-creator.js +++ b/keyserver/src/creators/thread-creator.js @@ -19,7 +19,7 @@ threadTypeIsCommunityRoot, } from 'lib/types/thread-types-enum.js'; import { - type ServerNewThreadRequest, + type ServerNewThinThreadRequest, type NewThreadResponse, } from 'lib/types/thread-types.js'; import type { ServerUpdateInfo } from 'lib/types/update-types.js'; @@ -78,7 +78,7 @@ // nonnegative role for the parent thread. async function createThread( viewer: Viewer, - request: ServerNewThreadRequest, + request: ServerNewThinThreadRequest, options?: CreateThreadOptions, ): Promise { if (!viewer.loggedIn) { diff --git a/keyserver/src/responders/thread-responders.js b/keyserver/src/responders/thread-responders.js --- a/keyserver/src/responders/thread-responders.js +++ b/keyserver/src/responders/thread-responders.js @@ -13,7 +13,7 @@ type LeaveThreadRequest, type LeaveThreadResult, type UpdateThreadRequest, - type ServerNewThreadRequest, + type ServerNewThinThreadRequest, type NewThreadResponse, type ServerThreadJoinRequest, type ThreadJoinResult, @@ -144,29 +144,30 @@ initialMemberIDs: t.maybe(t.list(tUserID)), calendarQuery: t.maybe(entryQueryInputValidator), }; -const newThreadRequestInputValidator: TUnion = t.union([ - tShape({ - type: tNumEnum([threadTypes.SIDEBAR]), - sourceMessageID: tID, - ...threadRequestValidationShape, - }), - tShape({ - type: tNumEnum([ - threadTypes.COMMUNITY_OPEN_SUBTHREAD, - threadTypes.COMMUNITY_SECRET_SUBTHREAD, - threadTypes.GENESIS_PERSONAL, - threadTypes.COMMUNITY_ROOT, - threadTypes.COMMUNITY_ANNOUNCEMENT_ROOT, - threadTypes.COMMUNITY_OPEN_ANNOUNCEMENT_SUBTHREAD, - threadTypes.COMMUNITY_SECRET_ANNOUNCEMENT_SUBTHREAD, - ]), - ...threadRequestValidationShape, - }), -]); +const newThreadRequestInputValidator: TUnion = + t.union([ + tShape({ + type: tNumEnum([threadTypes.SIDEBAR]), + sourceMessageID: tID, + ...threadRequestValidationShape, + }), + tShape({ + type: tNumEnum([ + threadTypes.COMMUNITY_OPEN_SUBTHREAD, + threadTypes.COMMUNITY_SECRET_SUBTHREAD, + threadTypes.GENESIS_PERSONAL, + threadTypes.COMMUNITY_ROOT, + threadTypes.COMMUNITY_ANNOUNCEMENT_ROOT, + threadTypes.COMMUNITY_OPEN_ANNOUNCEMENT_SUBTHREAD, + threadTypes.COMMUNITY_SECRET_ANNOUNCEMENT_SUBTHREAD, + ]), + ...threadRequestValidationShape, + }), + ]); async function threadCreationResponder( viewer: Viewer, - request: ServerNewThreadRequest, + request: ServerNewThinThreadRequest, ): Promise { return await createThread(viewer, request, { silentlyFailMembers: request.type === threadTypes.SIDEBAR, diff --git a/lib/actions/thread-actions.js b/lib/actions/thread-actions.js --- a/lib/actions/thread-actions.js +++ b/lib/actions/thread-actions.js @@ -11,7 +11,7 @@ ChangeThreadSettingsPayload, LeaveThreadPayload, UpdateThreadRequest, - ClientNewThreadRequest, + ClientNewThinThreadRequest, NewThreadResult, ClientThreadJoinRequest, ThreadJoinPayload, @@ -207,7 +207,7 @@ const newThinThread = ( callKeyserverEndpoint: CallKeyserverEndpoint, - ): ((input: ClientNewThreadRequest) => Promise) => + ): ((input: ClientNewThinThreadRequest) => Promise) => async input => { const parentThreadID = input.parentThreadID ?? genesis().id; const keyserverID = extractKeyserverIDFromID(parentThreadID); @@ -225,7 +225,7 @@ }; function useNewThinThread(): ( - input: ClientNewThreadRequest, + input: ClientNewThinThreadRequest, ) => Promise { return useKeyserverCall(newThinThread); } diff --git a/lib/shared/thread-actions-utils.js b/lib/shared/thread-actions-utils.js --- a/lib/shared/thread-actions-utils.js +++ b/lib/shared/thread-actions-utils.js @@ -20,7 +20,7 @@ import { threadTypes } from '../types/thread-types-enum.js'; import type { ChangeThreadSettingsPayload, - ClientNewThreadRequest, + ClientNewThinThreadRequest, NewThreadResult, } from '../types/thread-types.js'; import type { DispatchActionPromise } from '../utils/redux-promise-utils.js'; @@ -47,7 +47,7 @@ type CreateRealThreadParameters = { +threadInfo: ThreadInfo, +dispatchActionPromise: DispatchActionPromise, - +createNewThinThread: ClientNewThreadRequest => Promise, + +createNewThinThread: ClientNewThinThreadRequest => Promise, +sourceMessageID: ?string, +viewerID: ?string, +handleError?: () => mixed, diff --git a/lib/types/thread-types.js b/lib/types/thread-types.js --- a/lib/types/thread-types.js +++ b/lib/types/thread-types.js @@ -261,7 +261,7 @@ +initialMemberIDs?: ?$ReadOnlyArray, +ghostMemberIDs?: ?$ReadOnlyArray, }; -type NewThreadRequest = +type NewThinThreadRequest = | { +type: 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12, ...BaseNewThreadRequest, @@ -272,12 +272,12 @@ ...BaseNewThreadRequest, }; -export type ClientNewThreadRequest = { - ...NewThreadRequest, +export type ClientNewThinThreadRequest = { + ...NewThinThreadRequest, +calendarQuery: CalendarQuery, }; -export type ServerNewThreadRequest = { - ...NewThreadRequest, +export type ServerNewThinThreadRequest = { + ...NewThinThreadRequest, +calendarQuery?: ?CalendarQuery, }; diff --git a/native/input/input-state-container.react.js b/native/input/input-state-container.react.js --- a/native/input/input-state-container.react.js +++ b/native/input/input-state-container.react.js @@ -85,7 +85,7 @@ } from 'lib/types/report-types.js'; import { threadTypes } from 'lib/types/thread-types-enum.js'; import { - type ClientNewThreadRequest, + type ClientNewThinThreadRequest, type NewThreadResult, } from 'lib/types/thread-types.js'; import { getConfig } from 'lib/utils/config.js'; @@ -155,7 +155,9 @@ input: SendMultimediaMessageInput, ) => Promise, +sendTextMessage: (input: SendTextMessageInput) => Promise, - +newThinThread: (request: ClientNewThreadRequest) => Promise, + +newThinThread: ( + request: ClientNewThinThreadRequest, + ) => Promise, +textMessageCreationSideEffectsFunc: CreationSideEffectsFunc, }; type State = { diff --git a/web/input/input-state-container.react.js b/web/input/input-state-container.react.js --- a/web/input/input-state-container.react.js +++ b/web/input/input-state-container.react.js @@ -82,7 +82,7 @@ import { reportTypes } from 'lib/types/report-types.js'; import { threadTypes } from 'lib/types/thread-types-enum.js'; import { - type ClientNewThreadRequest, + type ClientNewThinThreadRequest, type NewThreadResult, } from 'lib/types/thread-types.js'; import { @@ -149,7 +149,9 @@ input: LegacySendMultimediaMessageInput, ) => Promise, +sendTextMessage: (input: SendTextMessageInput) => Promise, - +newThinThread: (request: ClientNewThreadRequest) => Promise, + +newThinThread: ( + request: ClientNewThinThreadRequest, + ) => Promise, +pushModal: PushModal, +sendCallbacks: $ReadOnlyArray<() => mixed>, +registerSendCallback: (() => mixed) => void,