HomePhabricator
Diffusion Comm e61db1eae06a

[keyserver] Add message report creator

Description

[keyserver] Add message report creator

Summary:
Linear issue: ENG-160, ENG-1700. We need the keyserver to send a message report to the keyserver admin from the commbot user when a user
reports a message. This diff introduces functions for creating such report.

Test Plan:
Add the following to the textMessageCreationResponder in keyserver/src/responders/message-responders.js, right before return:

const reportedMessageID = rawMessageInfos[0].id;
if(reportedMessageID){
  await createMessageReport(viewer, { messageID: reportedMessageID });
}

And see that when a user sends a text message, ashoat user recievies a message from commbot saying

user user_name reported user_name’s message in chat titled chat_name

message

Add this to legacyMultimediaMessageCreationResponder right before return:

await createMessageReport(viewer, { messageID: id });

And see that when a user sends a multimedia message, ashoat user recievies a message from commbot saying

user user_name reported user_name’s message in chat titled chat_name
non-text message

So basically the message that is sent is also reported by the author
See that when chat between commbot and ashoat user doesn't exists it gets created, and when it exists it isn't created again, just a new message appears in the chat.

I also checked that when fetching the keyserver admin or creating the message with the report fail the creator throws an error. I did that by setting keyserverAdminID = null, result = [] (in createMessageReport), respectively, by hand. This error will be handled on the client side and is meant to be an indicator of whether the report was successful or not. In all other cases the report should succeed.

Reviewers: tomek, atul, abosh, ashoat

Reviewed By: tomek, atul, abosh, ashoat

Subscribers: ashoat

Differential Revision: https://phab.comm.dev/D4941

Details

Provenance
InkaSokolowskaAuthored on Sep 30 2022, 3:33 AM
Reviewer
tomek
Differential Revision
D4941: [keyserver] Add message report creator
Parents
rCOMM8ae399fb766c: Split createMessageReply to createMessageReply and createMessageQuote
Branches
Unknown
Tags
Unknown