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
Unknown Object (File)
Tue, Nov 26, 4:39 AM
Unknown Object (File)
Sun, Nov 24, 12:58 AM
Unknown Object (File)
Sat, Nov 23, 10:42 PM
Unknown Object (File)
Sat, Nov 23, 10:01 PM
Unknown Object (File)
Sat, Nov 23, 9:08 PM
Unknown Object (File)
Sat, Nov 23, 8:33 PM
Unknown Object (File)
Sat, Nov 23, 6:30 PM
Unknown Object (File)
Sat, Nov 23, 1:25 PM
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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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