From ac07479edd9e3e89f4f05316bbc1eeb5d83d732f Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Fri, 8 Mar 2024 14:52:31 +0800 Subject: [PATCH] Fix wrong account shown for multiple same-username links --- src/utils/handle-content-links.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/utils/handle-content-links.js b/src/utils/handle-content-links.js index 9637f211..be6547fb 100644 --- a/src/utils/handle-content-links.js +++ b/src/utils/handle-content-links.js @@ -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();