Skip to content

Commit

Permalink
fixed reply loader
Browse files Browse the repository at this point in the history
  • Loading branch information
nuclearfog committed Nov 9, 2023
1 parent debf562 commit 7231503
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ public Statuses getUserlistStatuses(long id, long minId, long maxId) throws Mast
public Statuses getStatusReplies(long id, long minId, long maxId) throws MastodonException {
Statuses statusThreads = getStatuses(ENDPOINT_STATUS + id + "/context", new ArrayList<>(0), minId, maxId);
Statuses result = new Statuses();
// todo add option to toggle viewing whole thread
// fixme pagination broken
for (Status status : statusThreads) {
if (status != null && (minId == 0L || status.getId() > minId) && (maxId == 0L || status.getId() < maxId)) {
result.add(status);
Expand Down Expand Up @@ -1520,7 +1520,8 @@ private Statuses getStatuses(String endpoint, List<String> params, long minId, l
params.add("limit=" + settings.getListSize());
try {
Statuses result = createStatuses(get(endpoint, params));
if (result.size() > 1)
// posts from reply endpoint should not be sorted
if (result.size() > 1 && !endpoint.endsWith("/context"))
Collections.sort(result);
return result;
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,9 @@ public Statuses getReplies(long id) {

SQLiteDatabase db = adapter.getDbRead();
Cursor cursor = db.rawQuery(REPLY_QUERY, args);
return getStatuses(cursor, db);
Statuses result = getStatuses(cursor, db);
result.setNextCursor(Statuses.NO_ID);
return result;
}
}

Expand Down

0 comments on commit 7231503

Please sign in to comment.