Skip to content

Commit

Permalink
Extend tree recovery to group folders
Browse files Browse the repository at this point in the history
When ‑loadTree:rootNode: returns NO, recover group folders as well as
RSS and OpenReader folders by reattaching them under the root folder.

A user reported in issue #1784 losing group folders which just went
invisible but were still present in database.
  • Loading branch information
barijaona committed Jul 29, 2024
1 parent ef21717 commit d102e6a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions Vienna/Sources/Main window/FoldersTree.m
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,9 @@ -(void)reloadDatabase:(NSArray *)stateArray
// recover from problems by putting missing folders under root node
NSArray *allFolders = [[[Database sharedManager] arrayOfAllFolders]
sortedArrayUsingSelector:@selector(folderNameCompare:)]; // all RSS and group folders
NSArray *installedFolders = [self folders:0]; // RSS folders already present
for (Folder *folder in allFolders) {
if ((folder.type == VNAFolderTypeRSS || folder.type == VNAFolderTypeOpenReader)
&& ![installedFolders containsObject:folder])
{
(void)[[TreeNode alloc] init:self.rootNode atIndex:-1 folder:folder canHaveChildren:NO];
if (![[self children:0] containsObject:folder]) { // not in already installed RSS and group folders
(void)[[TreeNode alloc] init:self.rootNode atIndex:-1 folder:folder canHaveChildren:folder.isGroupFolder];
}
}
// save the state after recovery
Expand Down

0 comments on commit d102e6a

Please sign in to comment.