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: except DbError:
discard discard
Prefs.theme.safeAddColumn Prefs.theme.safeAddColumn
Prefs.hidePins.safeAddColumn
proc getDefaultPrefs(cfg: Config): Prefs = proc getDefaultPrefs(cfg: Config): Prefs =
result = genDefaultPrefs() result = genDefaultPrefs()

View File

@ -63,7 +63,11 @@ const prefList*: OrderedTable[string, seq[Pref]] = {
Pref(kind: checkbox, name: "stickyProfile", Pref(kind: checkbox, name: "stickyProfile",
label: "Make profile sidebar stick to top", label: "Make profile sidebar stick to top",
defaultState: true) defaultState: true),
Pref(kind: checkbox, name: "hidePins",
label: "Hide pinned tweets",
defaultState: false),
] ]
}.toOrderedTable }.toOrderedTable

View File

@ -91,6 +91,7 @@ proc renderTimelineTweets*(results: Result[Tweet]; prefs: Prefs; path: string):
var retweets: seq[int] var retweets: seq[int]
for tweet in results.content: for tweet in results.content:
if tweet.threadId in threads or tweet.id in retweets: continue 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)) let thread = results.content.filterIt(threadFilter(it, tweet.threadId))
if thread.len < 2: if thread.len < 2:
if tweet.retweet.isSome: if tweet.retweet.isSome: