From 0f43d37c9e8979d1dbb16cc962bbe5c76e742316 Mon Sep 17 00:00:00 2001 From: Zed Date: Tue, 29 Oct 2019 18:32:35 +0100 Subject: [PATCH] Add pref to hide pins --- src/prefs.nim | 1 + src/prefs_impl.nim | 6 +++++- src/views/timeline.nim | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/prefs.nim b/src/prefs.nim index 6b200c0..f3ca78a 100644 --- a/src/prefs.nim +++ b/src/prefs.nim @@ -27,6 +27,7 @@ withDb: except DbError: discard Prefs.theme.safeAddColumn + Prefs.hidePins.safeAddColumn proc getDefaultPrefs(cfg: Config): Prefs = result = genDefaultPrefs() diff --git a/src/prefs_impl.nim b/src/prefs_impl.nim index 6417a9f..38baee2 100644 --- a/src/prefs_impl.nim +++ b/src/prefs_impl.nim @@ -63,7 +63,11 @@ const prefList*: OrderedTable[string, seq[Pref]] = { Pref(kind: checkbox, name: "stickyProfile", label: "Make profile sidebar stick to top", - defaultState: true) + defaultState: true), + + Pref(kind: checkbox, name: "hidePins", + label: "Hide pinned tweets", + defaultState: false), ] }.toOrderedTable diff --git a/src/views/timeline.nim b/src/views/timeline.nim index 54b3156..5c529e4 100644 --- a/src/views/timeline.nim +++ b/src/views/timeline.nim @@ -91,6 +91,7 @@ proc renderTimelineTweets*(results: Result[Tweet]; prefs: Prefs; path: string): var retweets: seq[int] for tweet in results.content: if tweet.threadId in threads or tweet.id in retweets: continue + if tweet.pinned and prefs.hidePins: continue let thread = results.content.filterIt(threadFilter(it, tweet.threadId)) if thread.len < 2: if tweet.retweet.isSome: