Fix missing "Show thread" links

This commit is contained in:
Zed
2019-09-19 03:51:15 +02:00
parent 10bcf99205
commit 19659de410
3 changed files with 6 additions and 4 deletions

View File

@@ -35,8 +35,9 @@ proc renderNoneFound(): VNode =
proc renderThread(thread: seq[Tweet]; prefs: Prefs; path: string): VNode =
buildHtml(tdiv(class="thread-line")):
for i, threadTweet in thread.sortedByIt(it.time):
let show = i == thread.len and thread[0].id != threadTweet.threadId
renderTweet(threadTweet, prefs, path, class="thread",
index=i, total=thread.high)
index=i, total=thread.high, showThread=show)
proc threadFilter(it: Tweet; tweetThread: string): bool =
it.retweet.isNone and it.reply.len == 0 and it.threadId == tweetThread
@@ -83,7 +84,7 @@ proc renderTimelineTweets*(results: Result[Tweet]; prefs: Prefs; path: string):
if tweet.threadId in threads: continue
let thread = results.content.filterIt(threadFilter(it, tweet.threadId))
if thread.len < 2:
renderTweet(tweet, prefs, path)
renderTweet(tweet, prefs, path, showThread=tweet.hasThread)
else:
renderThread(thread, prefs, path)
threads &= tweet.threadId