Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3307507
D11940.id39929.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
8 KB
Referenced Files
None
Subscribers
None
D11940.id39929.diff
View Options
diff --git a/keyserver/src/endpoints.js b/keyserver/src/endpoints.js
--- a/keyserver/src/endpoints.js
+++ b/keyserver/src/endpoints.js
@@ -24,6 +24,14 @@
fetchInviteLinksResponseValidator,
inviteLinkVerificationResponseValidator,
} from 'lib/types/validators/link-validators.js';
+import { messageReportCreationResultValidator } from 'lib/types/validators/message-report-validators.js';
+import {
+ fetchMessageInfosResponseValidator,
+ fetchPinnedMessagesResultValidator,
+ searchMessagesResponseValidator,
+ sendEditMessageResponseValidator,
+ sendMessageResponseValidator,
+} from 'lib/types/validators/message-validators.js';
import { updateUserAvatarRequestValidator } from 'lib/utils/avatar-utils.js';
import {
@@ -73,7 +81,6 @@
import {
messageReportCreationResponder,
messageReportCreationRequestInputValidator,
- messageReportCreationResultValidator,
} from './responders/message-report-responder.js';
import {
textMessageCreationResponder,
@@ -83,18 +90,13 @@
editMessageCreationResponder,
fetchPinnedMessagesResponder,
searchMessagesResponder,
- sendMessageResponseValidator,
sendMultimediaMessageRequestInputValidator,
sendReactionMessageRequestInputValidator,
editMessageRequestInputValidator,
- sendEditMessageResponseValidator,
sendTextMessageRequestInputValidator,
fetchMessageInfosRequestInputValidator,
- fetchMessageInfosResponseValidator,
fetchPinnedMessagesResponderInputValidator,
- fetchPinnedMessagesResultValidator,
searchMessagesResponderInputValidator,
- searchMessagesResponseValidator,
} from './responders/message-responders.js';
import {
getInitialReduxStateResponder,
diff --git a/keyserver/src/responders/message-report-responder.js b/keyserver/src/responders/message-report-responder.js
--- a/keyserver/src/responders/message-report-responder.js
+++ b/keyserver/src/responders/message-report-responder.js
@@ -6,7 +6,6 @@
type MessageReportCreationRequest,
type MessageReportCreationResult,
} from 'lib/types/message-report-types.js';
-import { rawMessageInfoValidator } from 'lib/types/message-types.js';
import { tShape, tID } from 'lib/utils/validation-utils.js';
import createMessageReport from '../creators/message-report-creator.js';
@@ -17,9 +16,6 @@
messageID: tID,
});
-export const messageReportCreationResultValidator: TInterface<MessageReportCreationResult> =
- tShape<MessageReportCreationResult>({ messageInfo: rawMessageInfoValidator });
-
async function messageReportCreationResponder(
viewer: Viewer,
request: MessageReportCreationRequest,
diff --git a/keyserver/src/responders/message-responders.js b/keyserver/src/responders/message-responders.js
--- a/keyserver/src/responders/message-responders.js
+++ b/keyserver/src/responders/message-responders.js
@@ -23,8 +23,6 @@
type SendEditMessageResponse,
type FetchPinnedMessagesRequest,
type FetchPinnedMessagesResult,
- messageTruncationStatusesValidator,
- rawMessageInfoValidator,
type SearchMessagesResponse,
type SearchMessagesRequest,
} from 'lib/types/message-types.js';
@@ -32,7 +30,6 @@
import type { ReactionMessageData } from 'lib/types/messages/reaction.js';
import type { TextMessageData } from 'lib/types/messages/text.js';
import { threadPermissions } from 'lib/types/thread-permission-types.js';
-import { userInfosValidator } from 'lib/types/user-types.js';
import { ServerError } from 'lib/utils/errors.js';
import { values } from 'lib/utils/objects.js';
import {
@@ -72,9 +69,6 @@
sidebarCreation: t.maybe(t.Boolean),
});
-export const sendMessageResponseValidator: TInterface<SendMessageResponse> =
- tShape<SendMessageResponse>({ newMessageInfo: rawMessageInfoValidator });
-
async function textMessageCreationResponder(
viewer: Viewer,
request: SendTextMessageRequest,
@@ -127,13 +121,6 @@
numberPerThread: t.maybe(t.Number),
});
-export const fetchMessageInfosResponseValidator: TInterface<FetchMessageInfosResponse> =
- tShape<FetchMessageInfosResponse>({
- rawMessageInfos: t.list(rawMessageInfoValidator),
- truncationStatuses: messageTruncationStatusesValidator,
- userInfos: userInfosValidator,
- });
-
async function messageFetchResponder(
viewer: Viewer,
request: FetchMessageInfosRequest,
@@ -316,11 +303,6 @@
text: t.String,
});
-export const sendEditMessageResponseValidator: TInterface<SendEditMessageResponse> =
- tShape<SendEditMessageResponse>({
- newMessageInfos: t.list(rawMessageInfoValidator),
- });
-
async function editMessageCreationResponder(
viewer: Viewer,
request: SendEditMessageRequest,
@@ -404,11 +386,6 @@
threadID: tID,
});
-export const fetchPinnedMessagesResultValidator: TInterface<FetchPinnedMessagesResult> =
- tShape<FetchPinnedMessagesResult>({
- pinnedMessages: t.list(rawMessageInfoValidator),
- });
-
async function fetchPinnedMessagesResponder(
viewer: Viewer,
request: FetchPinnedMessagesRequest,
@@ -423,12 +400,6 @@
cursor: t.maybe(tID),
});
-export const searchMessagesResponseValidator: TInterface<SearchMessagesResponse> =
- tShape<SearchMessagesResponse>({
- messages: t.list(rawMessageInfoValidator),
- endReached: t.Boolean,
- });
-
async function searchMessagesResponder(
viewer: Viewer,
request: SearchMessagesRequest,
diff --git a/keyserver/src/responders/responder-validators.test.js b/keyserver/src/responders/responder-validators.test.js
--- a/keyserver/src/responders/responder-validators.test.js
+++ b/keyserver/src/responders/responder-validators.test.js
@@ -16,14 +16,14 @@
inviteLinkVerificationResponseValidator,
fetchInviteLinksResponseValidator,
} from 'lib/types/validators/link-validators.js';
-
-import { messageReportCreationResultValidator } from './message-report-responder.js';
+import { messageReportCreationResultValidator } from 'lib/types/validators/message-report-validators.js';
import {
fetchMessageInfosResponseValidator,
fetchPinnedMessagesResultValidator,
sendEditMessageResponseValidator,
sendMessageResponseValidator,
-} from './message-responders.js';
+} from 'lib/types/validators/message-validators.js';
+
import { relationshipErrorsValidator } from './relationship-responders.js';
import { reportCreationResponseValidator } from './report-responders.js';
import { userSearchResultValidator } from './search-responders.js';
diff --git a/lib/types/validators/message-report-validators.js b/lib/types/validators/message-report-validators.js
new file mode 100644
--- /dev/null
+++ b/lib/types/validators/message-report-validators.js
@@ -0,0 +1,10 @@
+// @flow
+
+import type { TInterface } from 'tcomb';
+
+import { tShape } from '../../utils/validation-utils.js';
+import { type MessageReportCreationResult } from '../message-report-types.js';
+import { rawMessageInfoValidator } from '../message-types.js';
+
+export const messageReportCreationResultValidator: TInterface<MessageReportCreationResult> =
+ tShape<MessageReportCreationResult>({ messageInfo: rawMessageInfoValidator });
diff --git a/lib/types/validators/message-validators.js b/lib/types/validators/message-validators.js
new file mode 100644
--- /dev/null
+++ b/lib/types/validators/message-validators.js
@@ -0,0 +1,43 @@
+// @flow
+
+import t, { type TInterface } from 'tcomb';
+
+import { tShape } from '../../utils/validation-utils.js';
+import {
+ type FetchMessageInfosResponse,
+ type SendMessageResponse,
+ type SendEditMessageResponse,
+ type FetchPinnedMessagesResult,
+ type SearchMessagesResponse,
+} from '../message-types.js';
+import {
+ rawMessageInfoValidator,
+ messageTruncationStatusesValidator,
+} from '../message-types.js';
+import { userInfosValidator } from '../user-types.js';
+
+export const sendMessageResponseValidator: TInterface<SendMessageResponse> =
+ tShape<SendMessageResponse>({ newMessageInfo: rawMessageInfoValidator });
+
+export const sendEditMessageResponseValidator: TInterface<SendEditMessageResponse> =
+ tShape<SendEditMessageResponse>({
+ newMessageInfos: t.list(rawMessageInfoValidator),
+ });
+
+export const fetchMessageInfosResponseValidator: TInterface<FetchMessageInfosResponse> =
+ tShape<FetchMessageInfosResponse>({
+ rawMessageInfos: t.list(rawMessageInfoValidator),
+ truncationStatuses: messageTruncationStatusesValidator,
+ userInfos: userInfosValidator,
+ });
+
+export const fetchPinnedMessagesResultValidator: TInterface<FetchPinnedMessagesResult> =
+ tShape<FetchPinnedMessagesResult>({
+ pinnedMessages: t.list(rawMessageInfoValidator),
+ });
+
+export const searchMessagesResponseValidator: TInterface<SearchMessagesResponse> =
+ tShape<SearchMessagesResponse>({
+ messages: t.list(rawMessageInfoValidator),
+ endReached: t.Boolean,
+ });
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 20, 2:34 AM (22 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2540828
Default Alt Text
D11940.id39929.diff (8 KB)
Attached To
Mode
D11940: [lib][keyserver] Move output message and message report validators to lib
Attached
Detach File
Event Timeline
Log In to Comment