username = displayName matching, minus the shortcodes

This commit is contained in:
Lim Chee Aun 2022-12-22 10:32:27 +08:00
parent 4e60cae42c
commit 9a0f538d69

View file

@ -13,7 +13,11 @@ function NameText({ account, showAvatar, showAcct, short, external }) {
if (
!short &&
username.toLowerCase().trim() === (displayName || '').toLowerCase().trim()
username.toLowerCase().trim() ===
(displayName || '')
.replace(/(\:(\w|\+|\-)+\:)(?=|[\!\.\?]|$)/g, '') // Remove shortcodes, regex from https://regex101.com/r/iE9uV0/1
.toLowerCase()
.trim()
) {
username = null;
}