Add category filters for Updates tab (#3589)

* Add category filters for Updates tab

Works just like Library Updates.

Provides a tab in the Updates tab filter dialog to allow for including
& excluding of updates belonging to a title from a given category.

Excludes overpower Includes, as with Library Updates.

A little helpful text informs users about this.

* Changelog

* [skip ci] Remove unused string

Leftover from before I realized the Default category will always be
available for in-/exclusion.

* Make :includeEmpty/:excludeEmpty true Boolean params

* "include" -> "included"

Consistency with #3607.

* Remove DISTINCT from getRecentUpdatesWithFilters

Apparently not needed anymore (though it was required at some point).

* [skip ci] Fix Changelog
This commit is contained in:
MajorTanya
2026-08-02 12:59:58 +02:00
committed by GitHub
parent 6d69903a56
commit 1d8a2b05dd
10 changed files with 152 additions and 8 deletions
@@ -35,6 +35,8 @@ class UpdatesRepositoryImpl(
started: Boolean?,
bookmarked: Boolean?,
hideExcludedScanlators: Boolean,
includedCategories: List<Long>,
excludedCategories: List<Long>,
): Flow<List<UpdatesWithRelations>> {
return database.updatesViewQueries
.getRecentUpdatesWithFilters(
@@ -44,6 +46,10 @@ class UpdatesRepositoryImpl(
started = started?.toLong(),
bookmarked = bookmarked,
hideExcludedScanlators = hideExcludedScanlators.toLong(),
includedEmpty = includedCategories.isEmpty(),
excludedEmpty = excludedCategories.isEmpty(),
includedCategories = includedCategories,
excludedCategories = excludedCategories,
mapper = ::mapUpdatesWithRelations,
)
.subscribeToList()
@@ -46,6 +46,33 @@ AND (:bookmarked IS NULL OR bookmark = :bookmarked)
AND (
(excludedScanlator IS NULL OR :hideExcludedScanlators = 0)
)
AND (
-- includedEmpty being true expresses "don't care" state and bypasses the membership filter
:includedEmpty
OR EXISTS (
SELECT 1 FROM mangas_categories
WHERE mangas_categories.manga_id = mangaId
AND COALESCE(mangas_categories.category_id, 0) IN :includedCategories
)
OR (0 IN :includedCategories AND NOT EXISTS (
SELECT 1 FROM mangas_categories mc WHERE mc.manga_id = mangaId)
)
)
AND (
-- excludedEmpty being true expresses "don't care" state and bypasses the membership filter
:excludedEmpty
OR (
NOT EXISTS (
SELECT 1 FROM mangas_categories
WHERE mangas_categories.manga_id = mangaId
AND COALESCE(mangas_categories.category_id, 0) IN :excludedCategories
)
AND (
0 NOT IN :excludedCategories
OR EXISTS (SELECT 1 FROM mangas_categories WHERE mangas_categories.manga_id = mangaId)
)
)
)
LIMIT :limit;
getUpdatesByReadStatus: