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)
Fri, Dec 20, 12:54 AM
Unknown Object (File)
Sun, Dec 15, 7:45 PM
Unknown Object (File)
Tue, Dec 3, 11:28 AM
Unknown Object (File)
Sun, Dec 1, 6:14 AM
Unknown Object (File)
Thu, Nov 28, 2:53 PM
Unknown Object (File)
Nov 25 2024, 10:02 AM
Unknown Object (File)
Nov 25 2024, 9:31 AM
Unknown Object (File)
Nov 25 2024, 8:52 AM
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.