Hide tweets if they were retweeted on same page

This commit is contained in:
Zed 2019-09-20 01:17:25 +02:00
parent 1a356bc51d
commit 7a7c4d68e4
1 changed files with 4 additions and 1 deletions

View File

@ -80,10 +80,13 @@ proc renderTimelineTweets*(results: Result[Tweet]; prefs: Prefs; path: string):
renderNoneFound() renderNoneFound()
else: else:
var threads: seq[string] var threads: seq[string]
var retweets: seq[string]
for tweet in results.content: for tweet in results.content:
if tweet.threadId in threads: continue if tweet.threadId in threads or tweet.id in retweets: continue
let thread = results.content.filterIt(threadFilter(it, tweet.threadId)) let thread = results.content.filterIt(threadFilter(it, tweet.threadId))
if thread.len < 2: if thread.len < 2:
if tweet.retweet.isSome:
retweets &= tweet.id
renderTweet(tweet, prefs, path, showThread=tweet.hasThread) renderTweet(tweet, prefs, path, showThread=tweet.hasThread)
else: else:
renderThread(thread, prefs, path) renderThread(thread, prefs, path)