From fe7cbe3bd308760b5c398a4d600998ae3dd4cf47 Mon Sep 17 00:00:00 2001 From: Anh Do Date: Sat, 21 Mar 2020 21:25:39 -0400 Subject: [PATCH] Fix feed deletion in folder triggering unexpected deletes --- .../NewsBlurAccountDelegate+Internal.swift | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Frameworks/Account/NewsBlur/Internals/NewsBlurAccountDelegate+Internal.swift b/Frameworks/Account/NewsBlur/Internals/NewsBlurAccountDelegate+Internal.swift index 034d59f7e..880ecf5e6 100644 --- a/Frameworks/Account/NewsBlur/Internals/NewsBlurAccountDelegate+Internal.swift +++ b/Frameworks/Account/NewsBlur/Internals/NewsBlurAccountDelegate+Internal.swift @@ -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(())) }