Initial search refactoring
This commit is contained in:
@@ -13,8 +13,8 @@ proc renderMoreReplies(thread: Thread): VNode =
|
||||
|
||||
proc renderReplyThread(thread: Thread; prefs: Prefs): VNode =
|
||||
buildHtml(tdiv(class="reply thread thread-line")):
|
||||
for i, tweet in thread.tweets:
|
||||
let last = (i == thread.tweets.high and thread.more == 0)
|
||||
for i, tweet in thread.content:
|
||||
let last = (i == thread.content.high and thread.more == 0)
|
||||
renderTweet(tweet, prefs, index=i, last=last)
|
||||
|
||||
if thread.more != 0:
|
||||
@@ -26,7 +26,7 @@ proc renderConversation*(conversation: Conversation; prefs: Prefs): VNode =
|
||||
tdiv(class="main-thread"):
|
||||
if conversation.before != nil:
|
||||
tdiv(class="before-tweet thread-line"):
|
||||
for i, tweet in conversation.before.tweets:
|
||||
for i, tweet in conversation.before.content:
|
||||
renderTweet(tweet, prefs, index=i)
|
||||
|
||||
tdiv(class="main-tweet"):
|
||||
@@ -35,9 +35,9 @@ proc renderConversation*(conversation: Conversation; prefs: Prefs): VNode =
|
||||
|
||||
if hasAfter:
|
||||
tdiv(class="after-tweet thread-line"):
|
||||
let total = conversation.after.tweets.high
|
||||
let total = conversation.after.content.high
|
||||
let more = conversation.after.more
|
||||
for i, tweet in conversation.after.tweets:
|
||||
for i, tweet in conversation.after.content:
|
||||
renderTweet(tweet, prefs, index=i, last=(i == total and more == 0))
|
||||
|
||||
if more != 0:
|
||||
|
||||
@@ -65,9 +65,9 @@ proc threadFilter(it: Tweet; tweetThread: string): bool =
|
||||
proc renderTweets(timeline: Timeline; prefs: Prefs): VNode =
|
||||
buildHtml(tdiv(id="posts")):
|
||||
var threads: seq[string]
|
||||
for tweet in timeline.tweets:
|
||||
for tweet in timeline.content:
|
||||
if tweet.threadId in threads: continue
|
||||
let thread = timeline.tweets.filterIt(threadFilter(it, tweet.threadId))
|
||||
let thread = timeline.content.filterIt(threadFilter(it, tweet.threadId))
|
||||
if thread.len < 2:
|
||||
renderTweet(tweet, prefs, class="timeline-tweet")
|
||||
else:
|
||||
@@ -88,7 +88,7 @@ proc renderTimeline*(timeline: Timeline; username: string; protected: bool;
|
||||
|
||||
if protected:
|
||||
renderProtected(username)
|
||||
elif timeline.tweets.len == 0:
|
||||
elif timeline.content.len == 0:
|
||||
renderNoneFound()
|
||||
else:
|
||||
renderTweets(timeline, prefs)
|
||||
|
||||
Reference in New Issue
Block a user