When loading gap posts, apply filters before building display items.

This will make sure that items that are filtered out don't show up on the interface.
Fixes #675
This commit is contained in:
Angelo Suzuki 2023-08-31 14:01:58 +02:00
parent e5bdeba1d7
commit 09ba42a974
1 changed files with 1 additions and 1 deletions

View File

@ -270,6 +270,7 @@ public class HomeTimelineFragment extends StatusListFragment{
}else{ }else{
result=result.subList(0, endIndex); result=result.subList(0, endIndex);
} }
AccountSessionManager.get(accountID).filterStatuses(result, FilterContext.HOME);
List<StatusDisplayItem> targetList=displayItems.subList(gapPos, gapPos+1); List<StatusDisplayItem> targetList=displayItems.subList(gapPos, gapPos+1);
targetList.clear(); targetList.clear();
List<Status> insertedPosts=data.subList(gapPostIndex+1, gapPostIndex+1); List<Status> insertedPosts=data.subList(gapPostIndex+1, gapPostIndex+1);
@ -279,7 +280,6 @@ public class HomeTimelineFragment extends StatusListFragment{
targetList.addAll(buildDisplayItems(s)); targetList.addAll(buildDisplayItems(s));
insertedPosts.add(s); insertedPosts.add(s);
} }
AccountSessionManager.get(accountID).filterStatuses(insertedPosts, FilterContext.HOME);
if(targetList.isEmpty()){ if(targetList.isEmpty()){
// oops. We didn't add new posts, but at least we know there are none. // oops. We didn't add new posts, but at least we know there are none.
adapter.notifyItemRemoved(getMainAdapterOffset()+gapPos); adapter.notifyItemRemoved(getMainAdapterOffset()+gapPos);