From 59a72831c749b2198cb83d1b7cee74a5d05da723 Mon Sep 17 00:00:00 2001 From: Zed Date: Mon, 24 Jul 2023 04:26:32 +0200 Subject: [PATCH] Apply cached profile verified status to tweets --- src/routes/timeline.nim | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/routes/timeline.nim b/src/routes/timeline.nim index 8b8a23c..bf2a08e 100644 --- a/src/routes/timeline.nim +++ b/src/routes/timeline.nim @@ -66,13 +66,17 @@ proc fetchProfile*(after: string; query: Query; skipRail=false; if result.user.protected or result.user.suspended: return - if not skipPinned and query.kind == posts and - result.user.pinnedTweet > 0 and after.len == 0: - let tweet = await getCachedTweet(result.user.pinnedTweet) - if not tweet.isNil: - tweet.pinned = true - tweet.user = result.user - result.pinned = some tweet + if query.kind == posts: + if result.user.verified: + for chain in result.tweets.content: + if chain[0].user.id == result.user.id: + chain[0].user.verified = true + if not skipPinned and result.user.pinnedTweet > 0 and after.len == 0: + let tweet = await getCachedTweet(result.user.pinnedTweet) + if not tweet.isNil: + tweet.pinned = true + tweet.user = result.user + result.pinned = some tweet proc showTimeline*(request: Request; query: Query; cfg: Config; prefs: Prefs; rss, after: string): Future[string] {.async.} =