Better username lookup

This commit is contained in:
Lim Chee Aun 2022-12-14 15:39:20 +08:00
parent d4cdf2435f
commit 5c6fb7b7c8

View file

@ -695,9 +695,14 @@ function Status({
) {
e.preventDefault();
e.stopPropagation();
const username = target.querySelector('span');
const username = (
target.querySelector('span') || target
).innerText
.trim()
.replace(/^@/, '');
const mention = mentions.find(
(mention) => mention.username === username?.innerText.trim(),
(mention) =>
mention.username === username || mention.acct === username,
);
if (mention) {
states.showAccount = mention.acct;