Page MenuHomePhabricator

[keyserver] Pull `fetchUploadsForMessage(...)` out of `fetchMediaFromMediaMessageContent(...)`
ClosedPublic

Authored by atul on Sep 8 2022, 11:42 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 16, 10:56 AM
Unknown Object (File)
Tue, Apr 16, 9:53 AM
Unknown Object (File)
Tue, Apr 16, 3:11 AM
Unknown Object (File)
Mon, Apr 15, 6:55 PM
Unknown Object (File)
Mon, Apr 15, 1:04 AM
Unknown Object (File)
Mon, Apr 15, 12:54 AM
Unknown Object (File)
Sat, Apr 13, 11:56 PM
Unknown Object (File)
Sat, Apr 13, 8:03 PM
Subscribers

Details

Summary

Pull the serverDB uploads table query out of fetchMediaFromMediaMessageContent(...) into a separate function to make things a bit shorter and more readable.

This is effectively a noop, just repositioning things.


Depends on D5085

Test Plan

NA, effectively a noop...but sent a few messages and checked values at various breakpoints as a sanity check to ensure things worked as expected.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

atul requested review of this revision.Sep 8 2022, 11:52 PM
tomek added inline comments.
keyserver/src/fetchers/upload-fetchers.js
121 ↗(On Diff #16532)

Is there a way to have more concrete type here?

This revision is now accepted and ready to land.Sep 13 2022, 10:54 AM

rebase after resolving merge conflicts

keyserver/src/fetchers/upload-fetchers.js
121 ↗(On Diff #16532)

The existing fetchMedia(...) and mediaFromRow(...) type rows returned by the DB query as being Object. Noticed that this was a pattern elsewhere in the codebase as well.

Not sure if introducing a new type that contains every column of the returned row makes sense? What do you think the best approach would be here?


Going to land as-is since this is consistent with existing codebase, but happy to address any ideas in a subsequent diff.

keyserver/src/fetchers/upload-fetchers.js
121 ↗(On Diff #16532)

The problem with current approach is that this function can't be used without checking its internals. Also, modifying the returned value would not cause Flow to raise any error. So adding types for a row will make a lot of sense, but we can do this improvement in other places as well.