From 7cb1986a8fe49dc8fc8c85ed9d04044de630f3d2 Mon Sep 17 00:00:00 2001 From: Zed Date: Tue, 24 Sep 2019 00:52:38 +0200 Subject: [PATCH] Fix list pagination --- src/api/list.nim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/api/list.nim b/src/api/list.nim index 249ac5c..f140d48 100644 --- a/src/api/list.nim +++ b/src/api/list.nim @@ -27,8 +27,13 @@ proc getListTimeline*(username, list, agent, after: string): Future[Timeline] {. let json = await fetchJson(url ? params, headers) result = await finishTimeline(json, Query(), after, agent) - if result.content.len > 0: - result.minId = result.content[^1].id + if result.content.len == 0: + return + + let last = result.content[^1] + result.minId = + if last.retweet.isNone: last.id + else: get(last.retweet).id proc getListMembers*(username, list, agent: string): Future[Result[Profile]] {.async.} = let url = base / (listMembersUrl % [username, list])