Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3524731
D5022.id16975.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D5022.id16975.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
@@ -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
Details
Attached
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)
Attached To
Mode
D5022: [keyserver] Add message report responder
Attached
Detach File
Event Timeline
Log In to Comment