Fix readded chapters polluting 'Updates' tab. (#6377)

This commit is contained in:
FourTOne5 2021-12-24 20:28:48 +06:00 committed by GitHub
parent 1ab12e380a
commit 7eed8c440c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -121,11 +121,17 @@ fun syncChaptersWithSource(
for (i in toAdd.indices.reversed()) { for (i in toAdd.indices.reversed()) {
val chapter = toAdd[i] val chapter = toAdd[i]
chapter.date_fetch = now++ chapter.date_fetch = now++
if (chapter.isRecognizedNumber && chapter.chapter_number in deletedChapterNumbers) {
// Try to mark already read chapters as read when the source deletes them // Try to mark already read chapters as read when the source deletes them
if (chapter.isRecognizedNumber && chapter.chapter_number in deletedReadChapterNumbers) { if (chapter.chapter_number in deletedReadChapterNumbers) {
chapter.read = true chapter.read = true
} }
if (chapter.isRecognizedNumber && chapter.chapter_number in deletedChapterNumbers) { // Try to to use the fetch date it originally had to not pollute 'Updates' tab
toDelete.filter { it.chapter_number == chapter.chapter_number }
.minByOrNull { it.date_fetch }!!.let {
chapter.date_fetch = it.date_fetch
}
readded.add(chapter) readded.add(chapter)
} }
} }