Page MenuHomePhabricator

[keyserver] introduced reactionMessageCreationResponder function to message responders
ClosedPublic

Authored by ginsu on Nov 28 2022, 4:31 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 15, 9:58 AM
Unknown Object (File)
Mon, Nov 4, 2:03 AM
Unknown Object (File)
Fri, Nov 1, 6:37 PM
Unknown Object (File)
Fri, Nov 1, 6:37 PM
Unknown Object (File)
Fri, Nov 1, 6:36 PM
Unknown Object (File)
Fri, Nov 1, 6:36 PM
Unknown Object (File)
Fri, Nov 1, 6:36 PM
Unknown Object (File)
Fri, Nov 1, 6:35 PM
Subscribers

Details

Summary

introduced reactionMessageCreationResponder function to message responders. reactionMessageCreationResponder validates the input from the client, does the permission checks, and if everything is copacetic creates the reaction message data object, and sends it to createMessages where it gets pushed into the db


Depends on D5747 and D5752

Linear Task: ENG-2250

Test Plan

This will be tested further in subsequent diffs. But ran this locally on web/mobile and nothing crashed. Also helped me get to the point where I could push a reaction message into the DB (see screenshot below)

Screenshot 2022-11-28 at 7.16.55 PM.png (2×3 px, 1 MB)

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

ginsu requested review of this revision.Nov 28 2022, 4:45 PM
ashoat requested changes to this revision.Nov 28 2022, 7:02 PM
ashoat added inline comments.
keyserver/src/responders/message-responders.js
12 ↗(On Diff #18904)

Can't find where this type is in master or any of the diffs in the stack

202 ↗(On Diff #18904)

Great work checking this

This revision now requires changes to proceed.Nov 28 2022, 7:02 PM
ginsu requested review of this revision.Nov 29 2022, 7:01 AM
ginsu added inline comments.
keyserver/src/responders/message-responders.js
12 ↗(On Diff #18904)

My bad thought I included the diff where I introduced SendReactionMessageRequest for review yesterday but here it is:

D5752

added sendReactionMessageRequestInputValidator to this diff

keyserver/src/responders/message-responders.js
12 ↗(On Diff #18962)
tomek added inline comments.
keyserver/src/responders/message-responders.js
187 ↗(On Diff #18962)

Should we check if this is actually the only supported reaction?

187–198 ↗(On Diff #18962)

Can we make reaction mandatory in sendReactionMessageRequestInputValidator instead of checking if it's undefined later?

217 ↗(On Diff #18962)

Are there other constraints on reaction that can be verified?

Looks good!

(make sure to respond to @tomek's questions before landing)

This revision is now accepted and ready to land.Nov 30 2022, 2:21 PM

rebase with unsettingReaction field

keyserver/src/responders/message-responders.js
187 ↗(On Diff #18962)

@atul and I talked about making a set of supported reactions and using that set as an extra check. I was thinking of doing that in a subsequent diff, but if you prefer me to do that in this diff let me know!

187–198 ↗(On Diff #18962)

The new unsettingReaction field should address this, but please let me know if I missed something!

217 ↗(On Diff #18962)

@atul and I talked about making a set of supported reactions and using that set as an extra check. I was thinking of doing that in a subsequent diff, but if you prefer me to do that in this diff let me know!

rebase with action field

fixed inconsitency in privacy/blocking logic

ginsu requested review of this revision.Dec 19 2022, 5:03 PM

Rerequesting review because made some major changes with the creatorRelationshipHasBlock check in this responder

ashoat added 1 blocking reviewer(s): atul.
ashoat changed 2 blocking reviewer(s), added 1: tomek; removed 1: atul.

Looks good! A couple of small issues inline - feel free to request a review if some of them require significant changes.

keyserver/src/responders/message-responders.js
190
202–204

Wouldn't the validator catch !action? We're setting t.enums.of(['add_reaction', 'remove_reaction']) so it shouldn't be empty here.

212–216

It is confusing to see a result of fetchKnownUserInfos being assigned to a singular variable and then accessed as an object.

222–226

It seems like this and fetchKnownUserInfos could be awaited at the same time.

187 ↗(On Diff #18962)

I think at this point it is a matter of only a couple of chars changed, so it's worth doing it now.

This revision is now accepted and ready to land.Dec 20 2022, 9:20 AM