Page MenuHomePhabricator

[lib] Create function for extracing keyserver id from object id
ClosedPublic

Authored by inka on Sep 19 2023, 2:07 AM.
Tags
None
Referenced Files
F3354846: D9225.diff
Sat, Nov 23, 1:25 PM
Unknown Object (File)
Thu, Nov 21, 9:23 PM
Unknown Object (File)
Thu, Nov 21, 10:53 AM
Unknown Object (File)
Wed, Nov 20, 4:15 PM
Unknown Object (File)
Sun, Nov 10, 12:35 PM
Unknown Object (File)
Fri, Nov 8, 11:46 AM
Unknown Object (File)
Fri, Nov 8, 10:07 AM
Unknown Object (File)
Fri, Nov 8, 8:34 AM
Subscribers

Details

Summary

issue: https://linear.app/comm/issue/ENG-4682/create-a-function-to-extract-keyserver-id-from-ids
We need a function that will allow us to extract the keyserver id from message/thread/etc id

Test Plan

Ran the provided test suite

Diff Detail

Repository
rCOMM Comm
Branch
inka/actions_new_branch
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

inka requested review of this revision.Sep 19 2023, 2:24 AM
lib/utils/action-utils.js
42–46 ↗(On Diff #31249)

Wondering if we really have to match against two regexes. Can we simplify it and use only one?

47 ↗(On Diff #31249)

Can't we simply call return id.split('|')[0];?

This does not handle pending threads (more precisely sidebars created from a message). It's might be fine depending on the use case but I it feel like it should have a code comment in that case. Also agree with @tomek comments.

This does not handle pending threads (more precisely sidebars created from a message)

Pending threads exist in two contexts: pending sidebars, and pending chats created via the "Create new chat" interface.

Curiously, it does appear that BaseNewThreadRequest takes an optional id field. However, threadRequestValidationShape excludes this, meaning that it's only possible to set the id of a new thread from the keyserver. As such, I don't think pending thread IDs ever get passed up in an action... so this should (hopefully) be safe.

This revision is now accepted and ready to land.Oct 4 2023, 6:54 AM