Add pref to hide pins

This commit is contained in:
Zed 2019-10-29 18:32:35 +01:00
parent 76b9fcea76
commit 0f43d37c9e
3 changed files with 7 additions and 1 deletions

View file

@ -27,6 +27,7 @@ withDb:
except DbError:
discard
Prefs.theme.safeAddColumn
Prefs.hidePins.safeAddColumn
proc getDefaultPrefs(cfg: Config): Prefs =
result = genDefaultPrefs()

View file

@ -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

View file

@ -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: