Fix read/unread consideration of manga without any chapters

This commit is contained in:
schroda
2026-06-07 13:20:49 +02:00
parent e94012b39a
commit c2b2516a93
2 changed files with 9 additions and 4 deletions

View File

@@ -59,6 +59,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
- (**Reader**) Fix infinite scrolling sometimes not opening previous/next chapter - (**Reader**) Fix infinite scrolling sometimes not opening previous/next chapter
- (**Reader**) Fix preserving scroll position with RTL reading direction and a language that is read RTL - (**Reader**) Fix preserving scroll position with RTL reading direction and a language that is read RTL
- (**Browse**) Fix showing only nsfw sources in the browse source page when the "show nsfw" setting is disabled - (**Browse**) Fix showing only nsfw sources in the browse source page when the "show nsfw" setting is disabled
- (**Manga**) Fix mark as read/unread option not being disabled for manga without any chapters
## [20260509.01] (r3147) - 2026-05-09 ## [20260509.01] (r3147) - 2026-05-09

View File

@@ -144,15 +144,15 @@ export class Mangas {
} }
static isUnread({ unreadCount, chapters: { totalCount } }: MangaUnreadInfo): boolean { static isUnread({ unreadCount, chapters: { totalCount } }: MangaUnreadInfo): boolean {
return unreadCount === totalCount; return totalCount > 0 && unreadCount === totalCount;
} }
static getUnread<Mangas extends MangaUnreadInfo>(mangas: Mangas[]): Mangas[] { static getUnread<Mangas extends MangaUnreadInfo>(mangas: Mangas[]): Mangas[] {
return mangas.filter(Mangas.isUnread); return mangas.filter(Mangas.isUnread);
} }
static isFullyRead({ unreadCount }: MangaUnreadInfo): boolean { static isFullyRead({ unreadCount, chapters: { totalCount } }: MangaUnreadInfo): boolean {
return unreadCount === 0; return totalCount > 0 && unreadCount === 0;
} }
static getFullyRead<Mangas extends MangaUnreadInfo>(mangas: Mangas[]): Mangas[] { static getFullyRead<Mangas extends MangaUnreadInfo>(mangas: Mangas[]): Mangas[] {
@@ -160,7 +160,11 @@ export class Mangas {
} }
static isPartiallyRead(manga: MangaUnreadInfo): boolean { static isPartiallyRead(manga: MangaUnreadInfo): boolean {
return !Mangas.isUnread(manga) && !Mangas.isFullyRead(manga); const {
chapters: { totalCount },
} = manga;
return totalCount > 0 && !Mangas.isUnread(manga) && !Mangas.isFullyRead(manga);
} }
static getPartiallyRead<Mangas extends MangaUnreadInfo>(mangas: Mangas[]): Mangas[] { static getPartiallyRead<Mangas extends MangaUnreadInfo>(mangas: Mangas[]): Mangas[] {