1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-11 17:51:01 +00:00

add option to hide categories from the global unread list

This commit is contained in:
pennae 2021-06-03 02:39:47 +02:00 committed by fguillot
parent 571d7bf17c
commit 0bcfc81b1f
24 changed files with 109 additions and 30 deletions

View file

@ -181,9 +181,20 @@ func (e *EntryQueryBuilder) WithOffset(offset int) *EntryQueryBuilder {
return e
}
func (e *EntryQueryBuilder) WithGloballyVisible() *EntryQueryBuilder {
e.conditions = append(e.conditions, "not c.hide_globally")
return e
}
// CountEntries count the number of entries that match the condition.
func (e *EntryQueryBuilder) CountEntries() (count int, err error) {
query := `SELECT count(*) FROM entries e LEFT JOIN feeds f ON f.id=e.feed_id WHERE %s`
query := `
SELECT count(*)
FROM entries e
JOIN feeds f ON f.id = e.feed_id
JOIN categories c ON c.id = f.category_id
WHERE %s
`
condition := e.buildCondition()
err = e.store.db.QueryRow(fmt.Sprintf(query, condition), e.args...).Scan(&count)