Fix feed deletion in folder triggering unexpected deletes

This commit is contained in:
Anh Do 2020-03-21 21:25:39 -04:00
parent a9615560ae
commit fe7cbe3bd3
No known key found for this signature in database
GPG Key ID: 451E3092F917B62D
1 changed files with 11 additions and 2 deletions

View File

@ -479,13 +479,22 @@ extension NewsBlurAccountDelegate {
switch result {
case .success:
DispatchQueue.main.async {
account.clearWebFeedMetadata(feed)
account.removeWebFeed(feed)
let feedID = feed.webFeedID
if folderName == nil {
account.removeWebFeed(feed)
}
if let folders = account.folders {
for folder in folders where folderName != nil && folder.name == folderName {
folder.removeWebFeed(feed)
}
}
if account.flattenedWebFeeds().first(where: { $0.webFeedID == feedID }) == nil {
account.clearWebFeedMetadata(feed)
}
completion(.success(()))
}