Page MenuHomePhabricator

[keyserver] Return object from fetchEntryInfosByID
ClosedPublic

Authored by tomek on Aug 23 2023, 6:33 AM.
Tags
None
Referenced Files
F2827963: D8926.id30572.diff
Fri, Sep 27, 1:16 PM
F2827962: D8926.id30553.diff
Fri, Sep 27, 1:16 PM
F2827961: D8926.id30253.diff
Fri, Sep 27, 1:16 PM
F2827905: D8926.id.diff
Fri, Sep 27, 1:15 PM
F2827684: D8926.diff
Fri, Sep 27, 1:01 PM
Unknown Object (File)
Fri, Sep 27, 12:18 AM
Unknown Object (File)
Thu, Sep 26, 6:18 AM
Unknown Object (File)
Sun, Sep 15, 11:06 AM
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