Skip to content

Commit

Permalink
save own posts from timeline before removing them
Browse files Browse the repository at this point in the history
  • Loading branch information
sk22 committed Oct 18, 2023
1 parent f52886a commit b95d944
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,17 @@ public void onSuccess(List<Status> result){
last.hasGapAfter=last.id;
toAdd=result;
}
if(!toAdd.isEmpty())
AccountSessionManager.getInstance().getAccount(accountID).getCacheController().putHomeTimeline(new ArrayList<>(toAdd), false);
// removing statuses that come up as duplicates (hopefully only posts and boosts that were locally created
// and thus were already prepended to the timeline earlier)
List<String> existingIds=data.stream().map(Status::getID).collect(Collectors.toList());
toAdd.stream().filter(s->existingIds.contains(s.getID())).forEach(s->removeStatus(s));
List<Status> toAddUnfiltered=new ArrayList<>(toAdd);
toAdd.removeIf(s->existingIds.contains(s.getID()));
AccountSessionManager.get(accountID).filterStatuses(toAdd, getFilterContext());
if(!toAdd.isEmpty()){
prependItems(toAdd, true);
if(parent != null && GlobalUserPreferences.showNewPostsButton) parent.showNewPostsButton();
}
if(!toAddUnfiltered.isEmpty())
AccountSessionManager.getInstance().getAccount(accountID).getCacheController().putHomeTimeline(toAddUnfiltered, false);
refreshDone();
}

Expand Down

0 comments on commit b95d944

Please sign in to comment.