Changeset View
Changeset View
Standalone View
Standalone View
keyserver/src/responders/thread-responders.js
// @flow | // @flow | ||||
import t from 'tcomb'; | import t from 'tcomb'; | ||||
import type { TUnion, TInterface } from 'tcomb'; | import type { TUnion } from 'tcomb'; | ||||
import { | import { | ||||
type ThreadDeletionRequest, | type ThreadDeletionRequest, | ||||
type RoleChangeRequest, | type RoleChangeRequest, | ||||
type ChangeThreadSettingsResult, | type ChangeThreadSettingsResult, | ||||
type RemoveMembersRequest, | type RemoveMembersRequest, | ||||
type LeaveThreadRequest, | type LeaveThreadRequest, | ||||
type LeaveThreadResult, | type LeaveThreadResult, | ||||
▲ Show 20 Lines • Show All 120 Lines • ▼ Show 20 Lines | |||||
const threadRequestValidationShape = { | const threadRequestValidationShape = { | ||||
name: t.maybe(t.String), | name: t.maybe(t.String), | ||||
description: t.maybe(t.String), | description: t.maybe(t.String), | ||||
color: t.maybe(tColor), | color: t.maybe(tColor), | ||||
parentThreadID: t.maybe(t.String), | parentThreadID: t.maybe(t.String), | ||||
initialMemberIDs: t.maybe(t.list(t.String)), | initialMemberIDs: t.maybe(t.list(t.String)), | ||||
calendarQuery: t.maybe(entryQueryInputValidator), | calendarQuery: t.maybe(entryQueryInputValidator), | ||||
}; | }; | ||||
const newThreadRequestInputValidator: TUnion<TInterface> = t.union([ | const newThreadRequestInputValidator: TUnion<ServerNewThreadRequest> = t.union([ | ||||
tShape({ | tShape({ | ||||
type: tNumEnum([threadTypes.SIDEBAR]), | type: tNumEnum([threadTypes.SIDEBAR]), | ||||
sourceMessageID: t.String, | sourceMessageID: t.String, | ||||
...threadRequestValidationShape, | ...threadRequestValidationShape, | ||||
}), | }), | ||||
tShape({ | tShape({ | ||||
type: tNumEnum([ | type: tNumEnum([ | ||||
threadTypes.COMMUNITY_OPEN_SUBTHREAD, | threadTypes.COMMUNITY_OPEN_SUBTHREAD, | ||||
▲ Show 20 Lines • Show All 77 Lines • Show Last 20 Lines |