Change how showIcons is determined to take into consideration empty bylines

This commit is contained in:
Maurice Parker 2020-04-19 17:29:11 -05:00
parent b80270f65b
commit eeb7b518a8
2 changed files with 13 additions and 3 deletions

View File

@ -96,7 +96,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
if let representedObjects = representedObjects, representedObjects.count == 1 && representedObjects.first is WebFeed { if let representedObjects = representedObjects, representedObjects.count == 1 && representedObjects.first is WebFeed {
showFeedNames = { showFeedNames = {
for article in articles { for article in articles {
if article.authors?.contains(where: { $0.name != nil }) ?? false { if !article.byline().isEmpty {
return .byline return .byline
} }
} }
@ -955,11 +955,16 @@ private extension TimelineViewController {
} }
func updateShowIcons() { func updateShowIcons() {
if showFeedNames != .none { if showFeedNames == .feed {
self.showIcons = true self.showIcons = true
return return
} }
if showFeedNames == .none {
self.showIcons = false
return
}
for article in articles { for article in articles {
if let authors = article.authors { if let authors = article.authors {
for author in authors { for author in authors {

View File

@ -1462,7 +1462,7 @@ private extension SceneCoordinator {
if timelineFeed is WebFeed { if timelineFeed is WebFeed {
showFeedNames = { showFeedNames = {
for article in articles { for article in articles {
if article.authors?.contains(where: { $0.name != nil }) ?? false { if !article.byline().isEmpty {
return .byline return .byline
} }
} }
@ -1477,6 +1477,11 @@ private extension SceneCoordinator {
return return
} }
if showFeedNames == .none {
self.showIcons = false
return
}
for article in articles { for article in articles {
if let authors = article.authors { if let authors = article.authors {
for author in authors { for author in authors {