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)
Fri, Dec 20, 11:02 AM
Unknown Object (File)
Mon, Dec 16, 12:49 AM
Unknown Object (File)
Tue, Dec 10, 9:37 PM
Unknown Object (File)
Sat, Dec 7, 2:51 PM
Unknown Object (File)
Thu, Dec 5, 7:42 AM
Unknown Object (File)
Tue, Dec 3, 8:18 PM
Unknown Object (File)
Tue, Nov 26, 4:39 AM
Unknown Object (File)
Nov 24 2024, 12:58 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
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