HomePhabricator
Diffusion Comm c97013f91e24

[lib] Modify markdownUserMentionRegex to match ENS names as well

Description

[lib] Modify markdownUserMentionRegex to match ENS names as well

Summary:
Currently, for @ mentions, we use the oldValidUsernameRegexString to detect a valid account name ([a-zA-Z0-9-_]+). Since we're now extending support to @ mention users with ENS names, names can have . in them, so we need to adjust the regex accordingly.

Rather than modifying the oldValidUsernameRegexString which is used for account validation, I stopped using oldValidUsernameRegexString when detecting @ mentions and made a separate regex string. It is pretty close to the old one, except it also adds support for .'s in names

Depends on D10387

Test Plan:
Put some log statements in matchUserMentions and made sure that the line const username = result[2]; correctly extracted ENS names.

Previously it would only match jack, but now it can match jack.eth

Reviewers: atul, ginsu, inka

Reviewed By: inka

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D10388

Details

Provenance
rohanAuthored on Dec 18 2023, 11:05 AM
Reviewer
inka
Differential Revision
D10388: [lib] Modify markdownUserMentionRegex to match ENS names as well
Parents
rCOMM7b51ac43d61c: [lib/web/native] Show and search resolved ENS names in @ mentioning toolip
Branches
Unknown
Tags
Unknown