Page MenuHomePhabricator

[keyserver] Merge updated and legacy `multimediaMessageCreationResponder(...)`
ClosedPublic

Authored by atul on Sep 20 2022, 4:21 AM.
Tags
None
Referenced Files
F3561449: D5191.id16897.diff
Fri, Dec 27, 8:52 AM
F3559517: D5191.id16959.diff
Fri, Dec 27, 6:13 AM
F3559516: D5191.id16958.diff
Fri, Dec 27, 6:13 AM
F3559515: D5191.id16896.diff
Fri, Dec 27, 6:13 AM
F3559513: D5191.id16897.diff
Fri, Dec 27, 6:13 AM
F3559452: D5191.id.diff
Fri, Dec 27, 6:12 AM
F3559414: D5191.diff
Fri, Dec 27, 6:05 AM
Unknown Object (File)
Wed, Dec 4, 6:41 PM
Subscribers

Details

Summary

Addresses @tomek's feedback here: https://phab.comm.dev/D5127#150659

Basically cuts a bunch of redundant code and just branches where the two request payloads vary (mediaIDs vs mediaMessageContents)

Thought it was simpler to put up a refactor diff rather than go back and change D5127, hope that's okay.


Depends on D5127

Test Plan

Things continue to work as expected. Set breakpoints and observed correct values at each step.

Diff Detail

Repository
rCOMM Comm
Branch
master
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.Sep 20 2022, 4:23 AM
Harbormaster failed remote builds in B12308: Diff 16896!

be more explicit to help out flow

atul requested review of this revision.Sep 20 2022, 4:55 AM

Thought it was simpler to put up a refactor diff rather than go back and change D5127, hope that's okay.

From review point of view, it might make more sense to have a single diff. The reason is that the previous diff introduces a new function and this one deletes it. But let's keep the current structure.

keyserver/src/responders/message-responders.js
144–145

Another idea for simplification: what do you think about merging these functions?

152

This check is weaker than the previous one. Can we keep checking if the lengths match?

This revision is now accepted and ready to land.Sep 21 2022, 6:18 AM
keyserver/src/responders/message-responders.js
144–145

I think it makes sense to keep these two distinct

144–145

I tend to personally prefer branching at the level of a function rather than within a function

152

Based on discussion with @ashoat this is equivalent to the previous check. We weren't actually trying to account for situations where only some of the media was already assigned a container. The expectation was that either media.length would be 0 (if all the media were previously assigned to another message) or !0 in which case the assumption was that all the media could be assigned to the media message being created in this function.

This also simplifies the logic for the request.mediaIDs and request.mediaMessageContents cases

This revision was landed with ongoing or failed builds.Sep 21 2022, 1:07 PM
This revision was automatically updated to reflect the committed changes.