From de8fe659ffc6a7687009fcf500ecaf02e01f52e7 Mon Sep 17 00:00:00 2001 From: Zed Date: Wed, 23 Oct 2019 09:47:15 +0200 Subject: [PATCH] Fix "Show thread" not being shown, link to thread --- src/views/timeline.nim | 7 ++++--- src/views/tweet.nim | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/views/timeline.nim b/src/views/timeline.nim index 6c3ec74..0fc0b3f 100644 --- a/src/views/timeline.nim +++ b/src/views/timeline.nim @@ -38,9 +38,10 @@ proc renderToTop(): VNode = proc renderThread(thread: seq[Tweet]; prefs: Prefs; path: string): VNode = buildHtml(tdiv(class="thread-line")): - for i, threadTweet in thread.sortedByIt(it.id): - let show = i == thread.len and thread[0].id != threadTweet.threadId - renderTweet(threadTweet, prefs, path, class="thread", + let sortedThread = thread.sortedByIt(it.id) + for i, tweet in sortedThread: + let show = i == thread.high and sortedThread[0].id != tweet.threadId + renderTweet(tweet, prefs, path, class="thread", index=i, total=thread.high, showThread=show) proc threadFilter(it: Tweet; thread: int): bool = diff --git a/src/views/tweet.nim b/src/views/tweet.nim index 6551dc6..ae1cbc1 100644 --- a/src/views/tweet.nim +++ b/src/views/tweet.nim @@ -272,5 +272,5 @@ proc renderTweet*(tweet: Tweet; prefs: Prefs; path: string; class=""; renderStats(tweet.stats, views) if showThread: - a(class="show-thread", href=getLink(tweet)): + a(class="show-thread", href=("/i/status/" & $tweet.threadId)): text "Show this thread"