Page MenuHomePhabricator

[web/keyserver] Handle different thread ids in url
ClosedPublic

Authored by michal on Sep 12 2023, 5:36 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 5, 11:02 AM
Unknown Object (File)
Fri, Apr 5, 11:02 AM
Unknown Object (File)
Fri, Apr 5, 11:02 AM
Unknown Object (File)
Fri, Apr 5, 11:02 AM
Unknown Object (File)
Fri, Apr 5, 10:53 AM
Unknown Object (File)
Mar 10 2024, 9:13 PM
Unknown Object (File)
Mar 7 2024, 2:03 PM
Unknown Object (File)
Feb 19 2024, 6:18 PM
Subscribers

Details

Summary

ENG-4752
Depends on D9147
Depends on D9146

We want to handle older links too. Previously the server just ignored errors if the link couldn't be converted (so e.g. it contained older ids). Now we convert the ids in the urlinfo to the new schema on the client and server always tries to convert them.

Test Plan

Navigated to:

  • http://localhost:3000/comm/chat/thread/256%7C91890/ and http://localhost:3000/comm/chat/thread/91890/ -> web app opened correct thread
  • http://localhost:3000/comm/chat/thread/pending/sidebar/256%7C91894/ and http://localhost:3000/comm/chat/thread/pending/sidebar/91894/ -> the keyserver doesn't support navigating to pending threads right now, so the web app opened on the most recent thread, but there were no error
  • http://localhost:3000/comm/chat/thread/new/83884+86227/ -> web app opened on the chat creation menu with the selected users
  • http://localhost:3000/comm/settings/account/ -> web app opened on settings

Also run yarn jest

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

atul added inline comments.
lib/utils/conversion-utils.js
35 ↗(On Diff #30966)

Nit: Would prefer using template literal instead of + operator to concatenate strings

42–54 ↗(On Diff #30966)

Could we go with something like

if (!pendingIDContents) {
  throw new Error('invalid_client_id_prefix');
}

if (!pendingIDContents.sourceMessageID) {
  return id;
}

return getPendingThreadID(
  pendingIDContents.threadType,
  pendingIDContents.memberIDs,
  pendingIDContents.sourceMessageID.substring(prefix.length),
);

to reduce indentation and improve readability?

This revision is now accepted and ready to land.Sep 14 2023, 9:46 AM