Page MenuHomePhabricator

[keyserver] Extract query for checking the existence of personal thread
ClosedPublic

Authored by inka on Aug 29 2022, 10:33 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 25, 3:43 PM
Unknown Object (File)
Sun, Apr 21, 11:38 AM
Unknown Object (File)
Sun, Apr 21, 11:38 AM
Unknown Object (File)
Sun, Apr 21, 11:38 AM
Unknown Object (File)
Sun, Apr 21, 11:38 AM
Unknown Object (File)
Sun, Apr 21, 11:38 AM
Unknown Object (File)
Sun, Apr 21, 11:38 AM
Unknown Object (File)
Sun, Apr 21, 11:34 AM

Details

Summary

This part of code has been exctraced in response to comments on D4941 (so it can be reused there)
Function searchForPersonalThread has been written in advance. It executes the query and returns it's result

Test Plan

Like D397

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

inka requested review of this revision.Aug 29 2022, 10:43 AM

naming and location somewhat based on keyserver/src/search/users.js

tomek requested changes to this revision.Aug 30 2022, 2:11 AM

What about putting the new query into thread-selectors file?

keyserver/src/search/threads.js
12 ↗(On Diff #16076)

We should almost never use any: it basically turns off Flow checks and can leak to other places https://flow.org/en/docs/types/any/. Does the library provide a type of SQL expression?

13–23 ↗(On Diff #16076)

This is really a nit, but we format our SQL in a particular way: each indentation is exactly 2 spaces long, including the first one.

This revision now requires changes to proceed.Aug 30 2022, 2:11 AM

Address Tomek's comments after consulting him

Make fetchPersonalThreadID retrun a string instead of QueryResults, as they only contain one thread ID for this query anyway

fetchPersonalThreadID is tested with D4941 - when chat between commbot and ashoat user for reporting messages exists, its ID will be fetched using fetchPersonalThreadID. If the function works correctly no new chat will be created for message report when a message report is sent, and new report will appear in the existing chat .

This revision is now accepted and ready to land.Aug 30 2022, 6:10 AM
keyserver/src/fetchers/thread-fetchers.js
231 ↗(On Diff #17216)

Not sure if Prettier is forcing this, but I think this line should be indented less (aligned with return)

keyserver/src/fetchers/thread-fetchers.js
231

This was landed without addressing my comment, so I went ahead and checked and confirmed that Prettier does not force this identation issue. I created D5272 to resolve, but in the future @inka please make sure you check all comments before landing a diff