From d687abcdc1004c75822a960de8fd54776e716463 Mon Sep 17 00:00:00 2001 From: FineFindus <63370021+FineFindus@users.noreply.github.com> Date: Wed, 15 Mar 2023 20:05:16 +0100 Subject: [PATCH] fix(custom-timelines): lookup profile by url Closes #107. Instead of using the (wrong) profileID on CustomTimelines, use the URL, which will be correctly resolved. --- .../android/fragments/CustomLocalTimelineFragment.java | 1 + .../main/java/org/joinmastodon/android/ui/text/HtmlParser.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/CustomLocalTimelineFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/CustomLocalTimelineFragment.java index 349a31bcf..9a89e3a44 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/CustomLocalTimelineFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/CustomLocalTimelineFragment.java @@ -47,6 +47,7 @@ public class CustomLocalTimelineFragment extends StatusListFragment { result=result.stream().filter(new StatusFilterPredicate(accountID, Filter.FilterContext.PUBLIC)).collect(Collectors.toList()); result.stream().forEach(status -> { status.account.acct += "@"+domain; + status.mentions.forEach(mention -> mention.id = null); status.reloadWhenClicked = true; }); diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/text/HtmlParser.java b/mastodon/src/main/java/org/joinmastodon/android/ui/text/HtmlParser.java index 2e6001832..27e7ec885 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/text/HtmlParser.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/text/HtmlParser.java @@ -100,7 +100,7 @@ public class HtmlParser{ } } - Map idsByUrl=mentions.stream().collect(Collectors.toMap(m->m.url, m->m.id)); + Map idsByUrl=mentions.stream().filter(mention -> mention.id != null).collect(Collectors.toMap(m->m.url, m->m.id)); // Hashtags in remote posts have remote URLs, these have local URLs so they don't match. // Map tagsByUrl=tags.stream().collect(Collectors.toMap(t->t.url, t->t.name));