Prevent deletes if there are no records to delete

This commit is contained in:
Maurice Parker 2020-04-29 19:17:02 -05:00
parent 095c8575f3
commit e83694ceb0

View File

@ -67,6 +67,11 @@ private extension CloudKitArticlesZoneDelegate {
let receivedArticleIDs = Set(receivedRecordIDs.map({ stripPrefix($0.externalID) }))
let deletableArticleIDs = receivedArticleIDs.subtracting(pendingStarredStatusArticleIDs)
guard !deletableArticleIDs.isEmpty else {
completion()
return
}
database.deleteSelectedForProcessing(Array(deletableArticleIDs)) { _ in
self.account?.delete(articleIDs: deletableArticleIDs) { _ in
completion()