From 153f93877dde2e195a1434eb2a10261a6fe32f4c Mon Sep 17 00:00:00 2001 From: Barijaona Ramaholimihaso Date: Sat, 4 Nov 2023 23:19:52 +0300 Subject: [PATCH] Fix mark all read for folder containing smart folders On a folder containing two smart folders, "Skip Folder" did not mark all articles as read. Issue 1532 --- Vienna/Sources/Main window/ArticleController.m | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Vienna/Sources/Main window/ArticleController.m b/Vienna/Sources/Main window/ArticleController.m index feb05c6cf0..ef7673bc03 100644 --- a/Vienna/Sources/Main window/ArticleController.m +++ b/Vienna/Sources/Main window/ArticleController.m @@ -880,9 +880,9 @@ -(void)markAllFoldersReadByArray:(NSArray *)folderArray } // Smart and Search folders are not included in folderArray when you mark all subscriptions read, - // so we need to mark articles read if they're the current folder. + // so we need to mark articles read if they're the current folder or might be inside it. Folder * currentFolder = [[Database sharedManager] folderFromID:currentFolderId]; - if (currentFolder != nil && ![folderArray containsObject:currentFolder]) { + if (currentFolder != nil && (currentFolder.type == VNAFolderTypeGroup || ![folderArray containsObject:currentFolder])) { for (Article * theArticle in folderArrayOfArticles) [theArticle markRead:YES]; } @@ -910,12 +910,11 @@ -(NSArray *)wrappedMarkAllFoldersReadInArray:(NSArray *)folderArray [refArray addObjectsFromArray:articleArray]; [[OpenReader sharedManager] markAllReadInFolder:folder]; } else { - // For smart folders, we only mark all read the current folder to - // simplify things. - if (folderId == currentFolderId) { - [refArray addObjectsFromArray:currentArrayOfArticles]; - [self innerMarkReadByArray:currentArrayOfArticles readFlag:YES]; - } + // For smart folders, we only mark read articles which should be visible with current filters + NSString *filterString = APPCONTROLLER.filterString; + NSArray * articleArray = [self applyFilter:[folder articlesWithFilter:filterString]]; + [refArray addObjectsFromArray:articleArray]; + [self innerMarkReadByArray:articleArray readFlag:YES]; } } return [refArray copy];