Fix empty pinned tweets when status wasn't found

This commit is contained in:
Zed 2022-01-23 09:11:14 +01:00
parent f58824cb35
commit d1a3e7ab58
2 changed files with 5 additions and 5 deletions

View File

@ -63,11 +63,6 @@ proc parseGraphListMembers*(js: JsonNode; cursor: string): Result[User] =
if js.isNull: return if js.isNull: return
# result.top = js{"previous_cursor_str"}.getStr
# result.bottom = js{"next_cursor_str"}.getStr
# if result.bottom.len == 1:
# result.bottom.setLen 0
let root = js{"data", "list", "members_timeline", "timeline", "instructions"} let root = js{"data", "list", "members_timeline", "timeline", "instructions"}
for instruction in root: for instruction in root:
if instruction{"type"}.getStr == "TimelineAddEntries": if instruction{"type"}.getStr == "TimelineAddEntries":
@ -373,6 +368,10 @@ proc parseConversation*(js: JsonNode; tweetId: string): Conversation =
result.replies.bottom = e.getCursor result.replies.bottom = e.getCursor
proc parseStatus*(js: JsonNode): Tweet = proc parseStatus*(js: JsonNode): Tweet =
with e, js{"errors"}:
if e.getError == tweetNotFound:
return
result = parseTweet(js) result = parseTweet(js)
if not result.isNil: if not result.isNil:
result.user = parseUser(js{"user"}) result.user = parseUser(js{"user"})

View File

@ -41,6 +41,7 @@ type
rateLimited = 88 rateLimited = 88
invalidToken = 89 invalidToken = 89
listIdOrSlug = 112 listIdOrSlug = 112
tweetNotFound = 144
forbidden = 200 forbidden = 200
badToken = 239 badToken = 239
noCsrf = 353 noCsrf = 353