Rename Article.webFeed to Article.feed.

This commit is contained in:
Brent Simmons
2023-07-02 16:22:14 -07:00
parent bb450ababa
commit 75f1eee00c
21 changed files with 47 additions and 51 deletions

View File

@@ -236,7 +236,7 @@ private extension ActivityManager {
#endif
func makeKeywords(_ article: Article) -> [String] {
let feedNameKeywords = makeKeywords(article.webFeed?.nameForDisplay)
let feedNameKeywords = makeKeywords(article.feed?.nameForDisplay)
let articleTitleKeywords = makeKeywords(ArticleStringFormatter.truncatedTitle(article))
return feedNameKeywords + articleTitleKeywords
}

View File

@@ -241,8 +241,8 @@ private extension ArticleRenderer {
d["dateline_style"] = "articleDateline"
}
d["feed_link_title"] = article.webFeed?.nameForDisplay ?? ""
d["feed_link"] = article.webFeed?.homePageURL ?? ""
d["feed_link_title"] = article.feed?.nameForDisplay ?? ""
d["feed_link"] = article.feed?.homePageURL ?? ""
d["byline"] = byline()
@@ -261,7 +261,7 @@ private extension ArticleRenderer {
}
func byline() -> String {
guard let authors = article?.authors ?? article?.webFeed?.authors, !authors.isEmpty else {
guard let authors = article?.authors ?? article?.feed?.authors, !authors.isEmpty else {
return ""
}
@@ -269,7 +269,7 @@ private extension ArticleRenderer {
// This code assumes that multiple authors would never match the feed name so that
// if there feed owner has an article co-author all authors are given the byline.
if authors.count == 1, let author = authors.first {
if author.name == article?.webFeed?.nameForDisplay {
if author.name == article?.feed?.nameForDisplay {
return ""
}
}
@@ -333,10 +333,10 @@ private extension Article {
var baseURL: URL? {
var s = link
if s == nil {
s = webFeed?.homePageURL
s = feed?.homePageURL
}
if s == nil {
s = webFeed?.url
s = feed?.url
}
guard let urlString = s else {

View File

@@ -50,7 +50,7 @@ private extension SendToMarsEditCommand {
let body = article.contentHTML ?? article.contentText ?? article.summary
let authorName = article.authors?.first?.name
let sender = SendToBlogEditorApp(targetDescriptor: targetDescriptor, title: article.title, body: body, summary: article.summary, link: article.externalLink, permalink: article.link, subject: nil, creator: authorName, commentsURL: nil, guid: article.uniqueID, sourceName: article.webFeed?.nameForDisplay, sourceHomeURL: article.webFeed?.homePageURL, sourceFeedURL: article.webFeed?.url)
let sender = SendToBlogEditorApp(targetDescriptor: targetDescriptor, title: article.title, body: body, summary: article.summary, link: article.externalLink, permalink: article.link, subject: nil, creator: authorName, commentsURL: nil, guid: article.uniqueID, sourceName: article.feed?.nameForDisplay, sourceHomeURL: article.feed?.homePageURL, sourceFeedURL: article.feed?.url)
let _ = sender.send()
}

View File

@@ -65,10 +65,10 @@ private extension Article {
// Feed name, or feed name + author name (if author is specified per-article).
// Includes trailing space.
if let feedName = webFeed?.nameForDisplay, let authorName = authors?.first?.name {
if let feedName = feed?.nameForDisplay, let authorName = authors?.first?.name {
return feedName + ", " + authorName + ": "
}
if let feedName = webFeed?.nameForDisplay {
if let feedName = feed?.nameForDisplay {
return feedName + ": "
}
return ""

View File

@@ -41,10 +41,6 @@ private func accountAndArticlesDictionary(_ articles: Set<Article>) -> [String:
extension Article {
var webFeed: WebFeed? {
return account?.existingWebFeed(withWebFeedID: webFeedID)
}
var url: URL? {
return URL.encodingSpacesIfNeeded(rawLink)
}
@@ -138,7 +134,7 @@ extension Article {
}
func byline() -> String {
guard let authors = authors ?? webFeed?.authors, !authors.isEmpty else {
guard let authors = authors ?? feed?.authors, !authors.isEmpty else {
return ""
}
@@ -146,7 +142,7 @@ extension Article {
// This code assumes that multiple authors would never match the feed name so that
// if there feed owner has an article co-author all authors are given the byline.
if authors.count == 1, let author = authors.first {
if author.name == webFeed?.nameForDisplay {
if author.name == feed?.nameForDisplay {
return ""
}
}
@@ -214,7 +210,7 @@ extension Article {
extension Article: SortableArticle {
var sortableName: String {
return webFeed?.name ?? ""
return feed?.name ?? ""
}
var sortableDate: Date {

View File

@@ -52,7 +52,7 @@ class IconImageCache {
if let iconImage = imageForAuthors(article.authors) {
return iconImage
}
guard let feed = article.webFeed else {
guard let feed = article.feed else {
return nil
}
return imageForFeed(feed)

View File

@@ -26,7 +26,7 @@ final class UserNotificationManager: NSObject {
}
for article in articles {
if !article.status.read, let webFeed = article.webFeed, webFeed.isNotifyAboutNewArticles ?? false {
if !article.status.read, let webFeed = article.feed, webFeed.isNotifyAboutNewArticles ?? false {
sendNotification(webFeed: webFeed, article: article)
}
}