diff --git a/src/prefs.nim b/src/prefs.nim index f3ca78a..27e8242 100644 --- a/src/prefs.nim +++ b/src/prefs.nim @@ -28,6 +28,7 @@ withDb: discard Prefs.theme.safeAddColumn Prefs.hidePins.safeAddColumn + Prefs.hideReplies.safeAddColumn proc getDefaultPrefs(cfg: Config): Prefs = result = genDefaultPrefs() diff --git a/src/prefs_impl.nim b/src/prefs_impl.nim index 38baee2..1217107 100644 --- a/src/prefs_impl.nim +++ b/src/prefs_impl.nim @@ -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 diff --git a/src/views/status.nim b/src/views/status.nim index 4cebb1e..a832e33 100644 --- a/src/views/status.nim +++ b/src/views/status.nim @@ -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")