Get the unread count from the timeline, instead of the database, only for the Today feed and only if it’s selected and it’s the only node selected.
This commit is contained in:
parent
cf1b3843ee
commit
fc0fc2055e
@ -499,10 +499,11 @@ private extension SidebarViewController {
|
||||
|
||||
func unreadCountFor(_ node: Node) -> Int {
|
||||
// If this node is the one and only selection,
|
||||
// and it’s the Today feed,
|
||||
// then the unread count comes from the timeline.
|
||||
// This ensures that any transients in the timeline
|
||||
// are accounted for in the unread count.
|
||||
if selectedNodes.count == 1 && node === selectedNodes.first! {
|
||||
if nodeShouldGetUnreadCountFromTimeline(node) {
|
||||
return delegate?.unreadCount(for: node.representedObject) ?? 0
|
||||
}
|
||||
|
||||
@ -512,6 +513,21 @@ private extension SidebarViewController {
|
||||
return 0
|
||||
}
|
||||
|
||||
func nodeShouldGetUnreadCountFromTimeline(_ node: Node) -> Bool {
|
||||
// Only if it’s selected, it’s the only node selected,
|
||||
// and it’s the Today feed — which may have transients that are unread.
|
||||
if selectedNodes.count != 1 {
|
||||
return false
|
||||
}
|
||||
if node !== selectedNodes.first! {
|
||||
return false
|
||||
}
|
||||
guard let smartFeed = node.representedObject as? SmartFeed else {
|
||||
return false
|
||||
}
|
||||
return smartFeed.type == .today
|
||||
}
|
||||
|
||||
func cellForRowView(_ rowView: NSTableRowView) -> SidebarCell? {
|
||||
return rowView.view(atColumn: 0) as? SidebarCell
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user