Fix list pagination

This commit is contained in:
Zed 2019-09-24 00:52:38 +02:00
parent 43a2bd529c
commit 7cb1986a8f

View file

@ -27,8 +27,13 @@ proc getListTimeline*(username, list, agent, after: string): Future[Timeline] {.
let json = await fetchJson(url ? params, headers) let json = await fetchJson(url ? params, headers)
result = await finishTimeline(json, Query(), after, agent) result = await finishTimeline(json, Query(), after, agent)
if result.content.len > 0: if result.content.len == 0:
result.minId = result.content[^1].id 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.} = proc getListMembers*(username, list, agent: string): Future[Result[Profile]] {.async.} =
let url = base / (listMembersUrl % [username, list]) let url = base / (listMembersUrl % [username, list])