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 5763bf203..80baea9aa 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 @@ -331,6 +331,10 @@ public abstract class StatusDisplayItem{ applyingFilter = predicate.getApplyingFilter(); } + // Hide statuses that have a filter action of hide + if(!new StatusFilterPredicate(accountID, filterContext, FilterAction.HIDE).test(status)) + return new ArrayList() ; + return statusForContent.filterRevealed ? items : new ArrayList<>(List.of(new WarningFilteredStatusDisplayItem(parentID, fragment, statusForContent, items, applyingFilter))); } diff --git a/mastodon/src/main/java/org/joinmastodon/android/utils/StatusFilterPredicate.java b/mastodon/src/main/java/org/joinmastodon/android/utils/StatusFilterPredicate.java index 5a1be6a0d..7d4652f79 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/utils/StatusFilterPredicate.java +++ b/mastodon/src/main/java/org/joinmastodon/android/utils/StatusFilterPredicate.java @@ -17,6 +17,7 @@ import org.joinmastodon.android.model.FilterContext; import org.joinmastodon.android.model.Status; import java.time.Instant; +import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.function.Predicate; @@ -39,8 +40,7 @@ public class StatusFilterPredicate implements Predicate{ this.filters = filters; this.context = context; this.action = action; - this.clientFilters = GlobalUserPreferences.showPostsWithoutAlt ? List.of() - : List.of(new AltTextFilter(WARN, HOME, PUBLIC, ACCOUNT, THREAD, NOTIFICATIONS)); + this.clientFilters = getClientFilters(); } public StatusFilterPredicate(List filters, FilterContext context){ @@ -56,8 +56,15 @@ public class StatusFilterPredicate implements Predicate{ filters=AccountSessionManager.getInstance().getAccount(accountID).wordFilters.stream().filter(f->f.context.contains(context)).collect(Collectors.toList()); this.context = context; this.action = action; - this.clientFilters = GlobalUserPreferences.showPostsWithoutAlt ? List.of() - : List.of(new AltTextFilter(WARN, HOME, PUBLIC, ACCOUNT, THREAD, NOTIFICATIONS)); + this.clientFilters = getClientFilters(); + } + + private List getClientFilters() { + List filters = new ArrayList<>(); + if(!GlobalUserPreferences.showPostsWithoutAlt) { + filters.add(new AltTextFilter(WARN, HOME, PUBLIC, ACCOUNT, THREAD, NOTIFICATIONS)); + } + return filters; } /**