Page MenuHomePhabricator

[keyserver][lib] Deduplicate invite link RegExps
ClosedPublic

Authored by ashoat on May 29 2024, 12:26 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jun 29, 1:11 AM
Unknown Object (File)
Sat, Jun 22, 12:32 AM
Unknown Object (File)
Sat, Jun 15, 9:26 PM
Unknown Object (File)
Fri, Jun 14, 8:16 AM
Unknown Object (File)
Tue, Jun 11, 5:24 PM
Unknown Object (File)
Mon, Jun 10, 8:46 AM
Unknown Object (File)
Mon, Jun 10, 5:02 AM
Unknown Object (File)
Mon, Jun 10, 2:21 AM
Subscribers
None

Details

Summary

While working on ENG-8263, I noticed we have this defined in three different places, in slightly different (but equivalent) ways.

In one case we separately enumerate A-Z and a-z as options, whereas in the other case we just use a-z and add the suffix i to indicate that the match is case-insensitive.

This diff dedups the three RegExps. I opted to standarize on the approach that avoids the i modifier, since I needed to represent the RegExp in raw string form for one usage.

Test Plan
  1. Flow
  2. Tested invite link flow end-to-end on web by creating an invite link as a keyserver admin, and then opening it in an Incognito tab as another user, and confirming I am able to join

Opted not to test native at all, but can test that too if helpful, and especially if we suspect this RegExp is further duplicated elsewhere.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tomek added inline comments.
lib/shared/invite-links.js
49 ↗(On Diff #40759)

We should add the start and the end of the string checks

This revision is now accepted and ready to land.Jun 3 2024, 1:57 AM
lib/shared/invite-links.js
49 ↗(On Diff #40759)

Oops, good catch