fix some mentions not being opened in Tusky (#2339)

* fix some mentions not being opened in Tusky

* link PR in code
This commit is contained in:
Konrad Pozniak 2022-02-15 17:04:00 +01:00 committed by GitHub
parent 97fe4f88c5
commit c20effe6c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 8 deletions

View File

@ -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) {