Skip to content

Commit

Permalink
feat(Quote): hide filtered quotes
Browse files Browse the repository at this point in the history
Hides quote of that would have been hidden by a filter, essentially
reverting back to the previous behaviour.

(Partially) Closes: #488
  • Loading branch information
FineFindus committed Aug 2, 2024
1 parent 81519fe commit 55259f1
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public static ArrayList<StatusDisplayItem> 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);
Expand Down Expand Up @@ -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())
Expand All @@ -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);
Expand Down

0 comments on commit 55259f1

Please sign in to comment.