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.preventDefault();
e.stopPropagation(); e.stopPropagation();
const username = target.querySelector('span'); const username = (
target.querySelector('span') || target
).innerText
.trim()
.replace(/^@/, '');
const mention = mentions.find( const mention = mentions.find(
(mention) => mention.username === username?.innerText.trim(), (mention) =>
mention.username === username || mention.acct === username,
); );
if (mention) { if (mention) {
states.showAccount = mention.acct; states.showAccount = mention.acct;