From 55259f103d878a67d83fea8d80e5d725e3069392 Mon Sep 17 00:00:00 2001 From: FineFindus Date: Sat, 3 Aug 2024 00:08:45 +0200 Subject: [PATCH] feat(Quote): hide filtered quotes Hides quote of that would have been hidden by a filter, essentially reverting back to the previous behaviour. (Partially) Closes: https://github.com/LucasGGamerM/moshidon/issues/488 --- .../android/ui/displayitems/StatusDisplayItem.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/StatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/StatusDisplayItem.java index 0109a954ce..455227fb88 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/StatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/StatusDisplayItem.java @@ -339,7 +339,7 @@ public static ArrayList buildItems(BaseStatusListFragment contentItems.add(new DummyStatusDisplayItem(parentID, fragment)); contentItems.addAll(buildItems(fragment, statusForContent.quote, accountID, parentObject, knownAccounts, filterContext, FLAG_NO_FOOTER|FLAG_INSET|FLAG_NO_EMOJI_REACTIONS|FLAG_IS_FOR_QUOTE)); } else if((flags & FLAG_INSET)==0 && statusForContent.mediaAttachments.isEmpty()){ - tryAddNonOfficialQuote(statusForContent, fragment, accountID); + tryAddNonOfficialQuote(statusForContent, fragment, accountID, filterContext); } if(contentItems!=items && statusForContent.spoilerRevealed){ items.addAll(contentItems); @@ -421,7 +421,7 @@ public static void buildPollItems(String parentID, BaseStatusListFragment fragme * Tries to adds a non-official quote to a status. * A non-official quote is a quote on an instance that does not support quotes officially. */ - private static void tryAddNonOfficialQuote(Status status, BaseStatusListFragment fragment, String accountID) { + private static void tryAddNonOfficialQuote(Status status, BaseStatusListFragment fragment, String accountID, FilterContext filterContext) { Matcher matcher=QUOTE_PATTERN.matcher(status.getStrippedText()); if(!matcher.find()) @@ -432,6 +432,7 @@ private static void tryAddNonOfficialQuote(Status status, BaseStatusListFragment new GetSearchResults(quoteURL, GetSearchResults.Type.STATUSES, true, null, 0, 0).setCallback(new Callback<>(){ @Override public void onSuccess(SearchResults results){ + AccountSessionManager.get(accountID).filterStatuses(results.statuses, filterContext); if (!results.statuses.isEmpty()){ status.quote=results.statuses.get(0); fragment.updateStatusWithQuote(status);