Make the All Unread feed eligible for the Clean Up command. Issue #2417
This commit is contained in:
parent
2879baf7ed
commit
3fed4774e3
|
@ -44,11 +44,20 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
|||
}
|
||||
|
||||
var isCleanUpAvailable: Bool {
|
||||
guard isReadFiltered ?? false else { return false }
|
||||
let isEligibleForCleanUp: Bool?
|
||||
|
||||
if representedObjects?.count == 1, let timelineFeed = representedObjects?.first as? Feed, timelineFeed.defaultReadFilterType == .alwaysRead {
|
||||
isEligibleForCleanUp = true
|
||||
} else {
|
||||
isEligibleForCleanUp = isReadFiltered
|
||||
}
|
||||
|
||||
guard isEligibleForCleanUp ?? false else { return false }
|
||||
|
||||
let readSelectedCount = selectedArticles.filter({ $0.status.read }).count
|
||||
let readArticleCount = articles.count - unreadCount
|
||||
let availableToCleanCount = readArticleCount - readSelectedCount
|
||||
|
||||
return availableToCleanCount > 0
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue