Page MenuHomePhabricator

[keyserver] Return object from fetchEntryInfosByID
ClosedPublic

Authored by tomek on Aug 23 2023, 6:33 AM.
Tags
None
Referenced Files
F3271753: D8926.diff
Sat, Nov 16, 5:19 AM
Unknown Object (File)
Thu, Nov 14, 7:50 PM
Unknown Object (File)
Sun, Nov 10, 3:59 PM
Unknown Object (File)
Sun, Nov 10, 3:59 PM
Unknown Object (File)
Sun, Nov 10, 3:59 PM
Unknown Object (File)
Sun, Nov 10, 3:58 PM
Unknown Object (File)
Tue, Nov 5, 2:12 AM
Unknown Object (File)
Tue, Oct 29, 5:06 PM
Subscribers

Details

Summary

All the others state syncs use objects instead of array when fetching entries, so it makes sense to make this consistent. Additionally, it is more efficient to access by id instead of iterating over array.

https://linear.app/comm/issue/ENG-4654/unify-interfaces-in-session-utils

Depends on D8925

Test Plan

Modify a couple of calendar entries in the keyserver db and check if the state is correctly fixed.

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

tomek requested review of this revision.Aug 23 2023, 6:59 AM
keyserver/src/fetchers/entry-fetchers.js
42 ↗(On Diff #30253)

Should we return null as we did before?
I don't know how much we care about null vs undefined but it can cause surprises.

kamil added inline comments.
keyserver/src/fetchers/entry-fetchers.js
42 ↗(On Diff #30253)

I think it shouldn't cause any harm when we use undefined, but in fact null seems more appropriate logically, to express there is no entry with given ID, rather than there is something not defined yet.

But I think we are mixing this approach a lot in the codebase 😄

81 ↗(On Diff #30253)

I assume it will converted and will work, but isn't this more correct?

This revision is now accepted and ready to land.Aug 24 2023, 3:05 PM
keyserver/src/fetchers/entry-fetchers.js
42 ↗(On Diff #30253)

Agree, will change it to null

81 ↗(On Diff #30253)

Interestingly it seems to be working correctly, but probably shouldn't. Obviously, converting to string is the right thing to do.

Convert to string explicitly and return null if the entry isn't found