Keep initial opened chapter as duplicate reference
In case "skip duplicated chapters" is enabled and the next chapter is from a different scanlator, the initial opened chapter should still be used to remove duplicated chapters. Otherwise, the original scanlator would get lost and the scanlator of the next chapter would get used, which was only a fallback chapter, because the initial chapters scanlator did not have a next chapter.
This commit is contained in:
@@ -342,7 +342,7 @@ export class Chapters {
|
||||
{
|
||||
offset = ChapterOffset.NEXT,
|
||||
...options
|
||||
}: { offset?: ChapterOffset; onlyUnread?: boolean; skipDupe?: boolean } = {},
|
||||
}: { offset?: ChapterOffset; onlyUnread?: boolean; skipDupe?: boolean; skipDupeChapter?: Chapter } = {},
|
||||
): Chapter | undefined {
|
||||
const nextChapters = Chapters.getNextChapters(currentChapter, chapters, { offset, ...options });
|
||||
|
||||
@@ -360,7 +360,8 @@ export class Chapters {
|
||||
offset = ChapterOffset.NEXT,
|
||||
onlyUnread = false,
|
||||
skipDupe = false,
|
||||
}: { offset?: ChapterOffset; onlyUnread?: boolean; skipDupe?: boolean } = {},
|
||||
skipDupeChapter = fromChapter,
|
||||
}: { offset?: ChapterOffset; onlyUnread?: boolean; skipDupe?: boolean; skipDupeChapter?: Chapter } = {},
|
||||
): Chapter[] {
|
||||
const fromChapterIndex = chapters.findIndex((chapter) => chapter.id === fromChapter.id);
|
||||
|
||||
@@ -370,7 +371,7 @@ export class Chapters {
|
||||
|
||||
const nextChaptersIncludingCurrent = chapters.slice(sliceStartIndex, sliceEndIndex);
|
||||
const uniqueNextChapters = skipDupe
|
||||
? Chapters.removeDuplicates(fromChapter, nextChaptersIncludingCurrent)
|
||||
? Chapters.removeDuplicates(skipDupeChapter, nextChaptersIncludingCurrent)
|
||||
: nextChaptersIncludingCurrent;
|
||||
const nextChapters = uniqueNextChapters.toSpliced(isNextChapterOffset ? -1 : 0, 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user