From 1a9e5a6c72170d89c4f25a4014a07b054cba7aa7 Mon Sep 17 00:00:00 2001 From: Zed Date: Fri, 5 Jun 2020 00:11:05 +0200 Subject: [PATCH] Fix user search pagination --- src/parser.nim | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/parser.nim b/src/parser.nim index 3bd1a2d..e102078 100644 --- a/src/parser.nim +++ b/src/parser.nim @@ -352,6 +352,15 @@ proc parseUsers*(js: JsonNode; after=""): Result[Profile] = let global = parseGlobalObjects(? js) let instructions = ? js{"timeline", "instructions"} + if instructions.len == 0: return + + for i in instructions: + with r, i{"replaceEntry", "entry"}: + if "top" in r{"entryId"}.getStr: + result.top = r.getCursor + elif "bottom" in r{"entryId"}.getStr: + result.bottom = r.getCursor + for e in instructions[0]{"addEntries", "entries"}: let entry = e{"entryId"}.getStr if "sq-I-u" in entry: @@ -375,7 +384,6 @@ proc parseTimeline*(js: JsonNode; after=""): Timeline = with pin, parsePin(i, global): result.content.add pin else: - # This is necessary for search with r, i{"replaceEntry", "entry"}: if "top" in r{"entryId"}.getStr: result.top = r.getCursor