 			configureUnreadCountForCellsForRepresentedObjects([representedObject as AnyObject])
 		}
 
-		if let feed = representedObject as? Feed, treeControllerDelegate.isReadFiltered, feed.unreadCount > 0 {
+		if let feed = representedObject as? Feed, isReadFiltered, feed.unreadCount > 0 {
+			addTreeControllerToFilterExceptions()
 			queueRebuildTreeAndRestoreSelection()
 		}
 	}

		
	}
	
	func deepLinkRevealAndSelect(for userInfo: [AnyHashable : Any]) {
		guard let accountNode = findAccountNode(userInfo), let feedNode = findFeedNode(userInfo, beginningAt: accountNode) else {
			return
		}
		revealAndSelectRepresentedObject(feedNode.representedObject)
	}

	func toggleReadFilter() {
		if treeControllerDelegate.isReadFiltered {
			treeControllerDelegate.isReadFiltered = false
		} else {
			treeControllerDelegate.isReadFiltered = true
		}
		rebuildTreeAndRestoreSelection()
	}

}

// MARK: - NSUserInterfaceValidations

extension SidebarViewController: NSUserInterfaceValidations {

	func validateUserInterfaceItem(_ item: NSValidatedUserInterfaceItem) -> Bool {
		if item.action == #selector(copy(_:)) {
			return NSPasteboard.general.canCopyAtLeastOneObject(selectedObjects)
		}
		return true
	}
}

//MARK: - Private

private extension SidebarViewController {
	
	var accountNodes: [Account] {
		return treeController.rootNode.childNodes.compactMap { $0.representedObject as? Account }
	}
	
	var selectedNodes: [Node] {
		if let nodes = outlineView.selectedItems as? [Node] {
			return nodes
		}
		return [Node]()
	}

	var singleSelectedNode: Node? {
		guard selectedNodes.count == 1 else {
			return nil
		}
		return selectedNodes.first!
	}

	var singleSelectedFeed: WebFeed? {
		guard let node = singleSelectedNode else {
			return nil
		}
		return node.representedObject as? WebFeed
	}

	func rebuildTreeAndReloadDataIfNeeded() {
		if !animatingChanges && !BatchUpdate.shared.isPerforming {
			treeController.rebuild()
			outlineView.reloadData()
		}
	}


	}

	@IBAction func openInBrowser(_ sender: Any?) {
		guard let feed = singleSelectedWebFeed, let homePageURL = feed.homePageURL else {
			return
		}
		Browser.open(homePageURL)
	}

	@IBAction func gotoToday(_ sender: Any?) {
		ensureFeedIsAvailableToSelect(SmartFeedsController.shared.todayFeed)
		outlineView.revealAndSelectRepresentedObject(SmartFeedsController.shared.todayFeed, treeController)
		focus()
	}

	@IBAction func gotoAllUnread(_ sender: Any?) {
		ensureFeedIsAvailableToSelect(SmartFeedsController.shared.unreadFeed)
		outlineView.revealAndSelectRepresentedObject(SmartFeedsController.shared.unreadFeed, treeController)
		focus()
	}

	@IBAction func gotoStarred(_ sender: Any?) {
		ensureFeedIsAvailableToSelect(SmartFeedsController.shared.starredFeed)
		outlineView.revealAndSelectRepresentedObject(SmartFeedsController.shared.starredFeed, treeController)
		focus()
	}
