Page MenuHomePhabricator

D5022.id16975.diff
No OneTemporary

D5022.id16975.diff

diff --git a/keyserver/src/endpoints.js b/keyserver/src/endpoints.js
--- a/keyserver/src/endpoints.js
+++ b/keyserver/src/endpoints.js
@@ -18,6 +18,7 @@
} from './responders/entry-responders';
import type { JSONResponder } from './responders/handlers';
import { getSessionPublicKeysResponder } from './responders/keys-responders';
+import { messageReportCreationResponder } from './responders/message-report-responder';
import {
textMessageCreationResponder,
messageFetchResponder,
@@ -58,6 +59,7 @@
create_account: accountCreationResponder,
create_entry: entryCreationResponder,
create_error_report: reportCreationResponder,
+ create_message_report: messageReportCreationResponder,
create_multimedia_message: multimediaMessageCreationResponder,
create_report: reportCreationResponder,
create_reports: reportMultiCreationResponder,
diff --git a/keyserver/src/responders/message-report-responder.js b/keyserver/src/responders/message-report-responder.js
new file mode 100644
--- /dev/null
+++ b/keyserver/src/responders/message-report-responder.js
@@ -0,0 +1,34 @@
+// @flow
+
+import t from 'tcomb';
+
+import {
+ type MessageReportCreationRequest,
+ type MessageReportCreationResult,
+} from 'lib/types/message-report-types';
+import { tShape } from 'lib/utils/validation-utils';
+
+import createMessageReport from '../creators/message-report-creator';
+import type { Viewer } from '../session/viewer';
+import { validateInput } from '../utils/validation-utils';
+
+const messageReportCreationRequestInputValidator = tShape({
+ messageID: t.String,
+});
+
+async function messageReportCreationResponder(
+ viewer: Viewer,
+ input: any,
+): Promise<MessageReportCreationResult> {
+ await validateInput(
+ viewer,
+ messageReportCreationRequestInputValidator,
+ input,
+ );
+ const request: MessageReportCreationRequest = input;
+
+ const rawMessageInfos = await createMessageReport(viewer, request);
+ return { messageInfo: rawMessageInfos[0] };
+}
+
+export { messageReportCreationResponder };
diff --git a/lib/types/endpoints.js b/lib/types/endpoints.js
--- a/lib/types/endpoints.js
+++ b/lib/types/endpoints.js
@@ -48,6 +48,7 @@
const socketPreferredEndpoints = Object.freeze({
CREATE_ENTRY: 'create_entry',
CREATE_ERROR_REPORT: 'create_error_report',
+ CREATE_MESSAGE_REPORT: 'create_message_report',
CREATE_MULTIMEDIA_MESSAGE: 'create_multimedia_message',
CREATE_TEXT_MESSAGE: 'create_text_message',
CREATE_THREAD: 'create_thread',

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 24, 2:15 PM (8 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2700184
Default Alt Text
D5022.id16975.diff (2 KB)

Event Timeline