From c20effe6c9d62aab9e8c8c7b878978089b9cfc11 Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Tue, 15 Feb 2022 17:04:00 +0100 Subject: [PATCH] fix some mentions not being opened in Tusky (#2339) * fix some mentions not being opened in Tusky * link PR in code --- .../java/com/keylesspalace/tusky/util/LinkHelper.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/util/LinkHelper.java b/app/src/main/java/com/keylesspalace/tusky/util/LinkHelper.java index 746bf5e69..4969c9ad0 100644 --- a/app/src/main/java/com/keylesspalace/tusky/util/LinkHelper.java +++ b/app/src/main/java/com/keylesspalace/tusky/util/LinkHelper.java @@ -87,17 +87,12 @@ public class LinkHelper { public void onClick(@NonNull View widget) { listener.onViewTag(tag); } }; } else if (text.charAt(0) == '@' && mentions != null && mentions.size() > 0) { - String accountUsername = text.subSequence(1, text.length()).toString(); - /* There may be multiple matches for users on different instances with the same - * username. If a match has the same domain we know it's for sure the same, but if - * that can't be found then just go with whichever one matched last. */ + // https://github.com/tuskyapp/Tusky/pull/2339 String id = null; for (Status.Mention mention : mentions) { - if (mention.getLocalUsername().equalsIgnoreCase(accountUsername)) { + if (mention.getUrl().equals(span.getURL())) { id = mention.getId(); - if (mention.getUrl().contains(getDomain(span.getURL()))) { - break; - } + break; } } if (id != null) {