1
0
Fork 0

Fix wrong account shown for multiple same-username links

This commit is contained in:
Lim Chee Aun 2024-03-08 14:52:31 +08:00
parent 306a96eec3
commit ac07479edd

View file

@ -24,12 +24,14 @@ function handleContentLinks(opts) {
).innerText.trim();
const username = targetText.replace(/^@/, '');
const url = target.getAttribute('href');
const mention = mentions.find(
(mention) =>
mention.username === username ||
mention.acct === username ||
mention.url === url,
);
// Only fallback to acct/username check if url doesn't match
const mention =
mentions.find((mention) => mention.url === url) ||
mentions.find(
(mention) =>
mention.acct === username || mention.username === username,
);
console.warn('MENTION', mention, url);
if (mention) {
e.preventDefault();
e.stopPropagation();