Use == instead of === when comparing feeds in the sidebar — you might have duplicate feeds. (Duplicate feeds are totally allowed.)

This commit is contained in:
Brent Simmons 2019-05-21 22:23:26 -07:00
parent a406fa9d4d
commit e05eb6e60c
1 changed files with 13 additions and 2 deletions

View File

@ -581,9 +581,8 @@ private extension SidebarViewController {
}
func applyToCellsForRepresentedObject(_ representedObject: AnyObject, _ callback: (SidebarCell, Node) -> Void) {
applyToAvailableCells { (cell, node) in
if node.representedObject === representedObject {
if node.representsSidebarObject(representedObject) {
callback(cell, node)
}
}
@ -607,3 +606,15 @@ private extension SidebarViewController {
}
private extension Node {
func representsSidebarObject(_ object: AnyObject) -> Bool {
if representedObject === object {
return true
}
if let feed1 = object as? Feed, let feed2 = representedObject as? Feed {
return feed1 == feed2
}
return false
}
}