Even shorter name text

This commit is contained in:
Lim Chee Aun 2023-01-05 10:41:25 +08:00
parent eef658b758
commit c77ed16804

View file

@ -16,6 +16,8 @@ function NameText({ account, showAvatar, showAcct, short, external, onClick }) {
username.toLowerCase().trim() ===
(displayName || '')
.replace(/(\:(\w|\+|\-)+\:)(?=|[\!\.\?]|$)/g, '') // Remove shortcodes, regex from https://regex101.com/r/iE9uV0/1
.replace(/\s+/g, '') // E.g. "My name" === "myname"
.replace(/[^a-z0-9]/gi, '') // Remove non-alphanumeric characters
.toLowerCase()
.trim()
) {