Add pref to hide tweet replies
This commit is contained in:
parent
0f43d37c9e
commit
25a6590a56
|
@ -28,6 +28,7 @@ withDb:
|
|||
discard
|
||||
Prefs.theme.safeAddColumn
|
||||
Prefs.hidePins.safeAddColumn
|
||||
Prefs.hideReplies.safeAddColumn
|
||||
|
||||
proc getDefaultPrefs(cfg: Config): Prefs =
|
||||
result = genDefaultPrefs()
|
||||
|
|
|
@ -68,6 +68,10 @@ const prefList*: OrderedTable[string, seq[Pref]] = {
|
|||
Pref(kind: checkbox, name: "hidePins",
|
||||
label: "Hide pinned tweets",
|
||||
defaultState: false),
|
||||
|
||||
Pref(kind: checkbox, name: "hideReplies",
|
||||
label: "Hide tweet replies",
|
||||
defaultState: false)
|
||||
]
|
||||
}.toOrderedTable
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ proc renderReplyThread(thread: Chain; prefs: Prefs; path: string): VNode =
|
|||
|
||||
proc renderConversation*(conversation: Conversation; prefs: Prefs; path: string): VNode =
|
||||
let hasAfter = conversation.after != nil
|
||||
let showReplies = not prefs.hideReplies
|
||||
buildHtml(tdiv(class="conversation")):
|
||||
tdiv(class="main-thread"):
|
||||
if conversation.before != nil:
|
||||
|
@ -48,14 +49,14 @@ proc renderConversation*(conversation: Conversation; prefs: Prefs; path: string)
|
|||
if more != 0:
|
||||
renderMoreReplies(conversation.after)
|
||||
|
||||
if not conversation.replies.beginning:
|
||||
if not conversation.replies.beginning and showReplies:
|
||||
renderNewer(Query(), getLink(conversation.tweet))
|
||||
|
||||
if conversation.replies.content.len > 0:
|
||||
if conversation.replies.content.len > 0 and showReplies:
|
||||
tdiv(class="replies", id="r"):
|
||||
for thread in conversation.replies.content:
|
||||
if thread == nil: continue
|
||||
renderReplyThread(thread, prefs, path)
|
||||
|
||||
if conversation.replies.hasMore:
|
||||
if conversation.replies.hasMore and showReplies:
|
||||
renderMore(Query(), conversation.replies.minId, focus="#r")
|
||||
|
|
Loading…
Reference in New Issue