|
@@ -1,4 +1,5 @@
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
+import sequtils
|
|
|
import karax/[karaxdsl, vdom]
|
|
import karax/[karaxdsl, vdom]
|
|
|
|
|
|
|
|
import ".."/[types, formatters]
|
|
import ".."/[types, formatters]
|
|
@@ -48,7 +49,7 @@ proc renderReplies*(replies: Result[Chain]; prefs: Prefs; path: string;
|
|
|
var hasReplies = false
|
|
var hasReplies = false
|
|
|
var replyCount = 0
|
|
var replyCount = 0
|
|
|
for thread in replies.content:
|
|
for thread in replies.content:
|
|
|
- if thread.content.len == 0: continue
|
|
|
|
|
|
|
+ if thread.content.len == 0 or thread.related: continue
|
|
|
hasReplies = true
|
|
hasReplies = true
|
|
|
replyCount += thread.content.len
|
|
replyCount += thread.content.len
|
|
|
renderReplyThread(thread, prefs, path)
|
|
renderReplyThread(thread, prefs, path)
|
|
@@ -58,6 +59,14 @@ proc renderReplies*(replies: Result[Chain]; prefs: Prefs; path: string;
|
|
|
let extra = if sort == Relevance: "" else: "sort=" & $sort & "&"
|
|
let extra = if sort == Relevance: "" else: "sort=" & $sort & "&"
|
|
|
renderMore(Query(), replies.bottom, focus="#r", extra=extra)
|
|
renderMore(Query(), replies.bottom, focus="#r", extra=extra)
|
|
|
|
|
|
|
|
|
|
+proc renderRelated(replies: Result[Chain]; prefs: Prefs; path: string): VNode =
|
|
|
|
|
+ buildHtml(tdiv(class="related-tweets")):
|
|
|
|
|
+ tdiv(class="related-header"):
|
|
|
|
|
+ text "Related tweets"
|
|
|
|
|
+ for thread in replies.content:
|
|
|
|
|
+ if thread.content.len == 0 or not thread.related: continue
|
|
|
|
|
+ renderReplyThread(thread, prefs, path)
|
|
|
|
|
+
|
|
|
proc renderConversation*(conv: Conversation; prefs: Prefs; path: string;
|
|
proc renderConversation*(conv: Conversation; prefs: Prefs; path: string;
|
|
|
sort = Relevance): VNode =
|
|
sort = Relevance): VNode =
|
|
|
let hasAfter = conv.after.content.len > 0
|
|
let hasAfter = conv.after.content.len > 0
|
|
@@ -95,6 +104,10 @@ proc renderConversation*(conv: Conversation; prefs: Prefs; path: string;
|
|
|
renderReplySort(sort)
|
|
renderReplySort(sort)
|
|
|
renderReplies(conv.replies, prefs, path, conv.tweet, sort)
|
|
renderReplies(conv.replies, prefs, path, conv.tweet, sort)
|
|
|
|
|
|
|
|
|
|
+ if not prefs.hideRelated:
|
|
|
|
|
+ if conv.replies.content.anyIt(it.related and it.content.len > 0):
|
|
|
|
|
+ renderRelated(conv.replies, prefs, path)
|
|
|
|
|
+
|
|
|
renderToTop(focus="#m")
|
|
renderToTop(focus="#m")
|
|
|
|
|
|
|
|
proc renderEditHistory*(edits: EditHistory; prefs: Prefs; path: string): VNode =
|
|
proc renderEditHistory*(edits: EditHistory; prefs: Prefs; path: string): VNode =
|