Fix user search parser

This commit is contained in:
Zed 2022-02-11 22:41:40 +01:00
parent a7f585feaa
commit 6695784050

View file

@ -15,14 +15,16 @@ proc parseUsers*(json: string; after=""): Result[User] =
if raw.timeline.instructions.len == 0: if raw.timeline.instructions.len == 0:
return return
for e in raw.timeline.instructions[0].addEntries.entries: for i in raw.timeline.instructions:
let id = e.entryId.getId if i.addEntries.entries.len > 0:
if e.entryId.startsWith("user"): for e in i.addEntries.entries:
if id in raw.globalObjects.users: let id = e.entryId.getId
result.content.add toUser raw.globalObjects.users[id] if e.entryId.startsWith("user"):
elif e.entryId.startsWith("cursor"): if id in raw.globalObjects.users:
let cursor = e.content.operation.cursor result.content.add toUser raw.globalObjects.users[id]
if cursor.cursorType == "Top": elif e.entryId.startsWith("cursor"):
result.top = cursor.value let cursor = e.content.operation.cursor
elif cursor.cursorType == "Bottom": if cursor.cursorType == "Top":
result.bottom = cursor.value result.top = cursor.value
elif cursor.cursorType == "Bottom":
result.bottom = cursor.value