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 Aug 4, 2024
1 parent a323c1e commit 80e5dfb
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Vienna/Sources/Main window/FoldersTree.m
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,16 @@ -(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
// install group folders first
for (Folder *folder in allFolders) {
if ((folder.type == VNAFolderTypeRSS || folder.type == VNAFolderTypeOpenReader)
&& ![installedFolders containsObject:folder])
if (folder.isGroupFolder && ![[self folders:0] containsObject:folder]) {
(void)[[TreeNode alloc] init:self.rootNode atIndex:-1 folder:folder canHaveChildren:YES];
}
}
// then install missing RSS folders
for (Folder *folder in allFolders) {
if ((folder.isRSSFolder || folder.isOpenReaderFolder)
&& ![[self folders:0] containsObject:folder])
{
(void)[[TreeNode alloc] init:self.rootNode atIndex:-1 folder:folder canHaveChildren:NO];
}
Expand All @@ -172,7 +178,7 @@ -(void)reloadDatabase:(NSArray *)stateArray
}
[self.outlineView reloadData];
[self unarchiveState:stateArray];
}
} // reloadDatabase

/* saveFolderSettings
* Preserve the expanded/collapsed and selection state of the folders list
Expand Down

0 comments on commit 80e5dfb

Please sign in to comment.