refactor(statusDisplayItem): move status hidden filter check to start of method to allow an early return
This optimises things by not computing the list of stuff when the status is simply not going to be rendered
This commit is contained in:
parent
18e3fadb26
commit
4d9f625ff4
|
@ -167,6 +167,10 @@ public abstract class StatusDisplayItem{
|
|||
args.putString("account", accountID);
|
||||
ScheduledStatus scheduledStatus = parentObject instanceof ScheduledStatus s ? s : null;
|
||||
|
||||
// Hide statuses that have a filter action of hide
|
||||
if(!new StatusFilterPredicate(accountID, filterContext, FilterAction.HIDE).test(status))
|
||||
return new ArrayList<StatusDisplayItem>() ;
|
||||
|
||||
HeaderStatusDisplayItem header=null;
|
||||
boolean hideCounts=!AccountSessionManager.get(accountID).getLocalPreferences().showInteractionCounts;
|
||||
|
||||
|
@ -363,10 +367,6 @@ public abstract class StatusDisplayItem{
|
|||
}
|
||||
}
|
||||
|
||||
// Hide statuses that have a filter action of hide
|
||||
if(!new StatusFilterPredicate(accountID, filterContext, FilterAction.HIDE).test(status))
|
||||
return new ArrayList<StatusDisplayItem>() ;
|
||||
|
||||
List<StatusDisplayItem> nonGapItems=gap!=null ? items.subList(0, items.size()-1) : items;
|
||||
WarningFilteredStatusDisplayItem warning=applyingFilter==null ? null :
|
||||
new WarningFilteredStatusDisplayItem(parentID, fragment, statusForContent, nonGapItems, applyingFilter);
|
||||
|
|
Loading…
Reference in New Issue