Discard the email address in the byline if it is a no reply. Issue #2351

This commit is contained in:
Maurice Parker 2020-08-18 17:44:28 -05:00
parent d98608fe3a
commit 1cda2ac3be
2 changed files with 16 additions and 6 deletions

View File

@ -218,19 +218,24 @@ private extension ArticleRenderer {
}
isFirstAuthor = false
if let emailAddress = author.emailAddress, emailAddress.contains(" ") {
var authorEmailAddress: String? = nil
if let emailAddress = author.emailAddress, !(emailAddress.contains("noreply@") || emailAddress.contains("no-reply@")) {
authorEmailAddress = emailAddress
}
if let emailAddress = authorEmailAddress, emailAddress.contains(" ") {
byline += emailAddress // probably name plus email address
}
else if let name = author.name, let url = author.url {
byline += name.htmlByAddingLink(url)
}
else if let name = author.name, let emailAddress = author.emailAddress {
else if let name = author.name, let emailAddress = authorEmailAddress {
byline += "\(name) <\(emailAddress)>"
}
else if let name = author.name {
byline += name
}
else if let emailAddress = author.emailAddress {
else if let emailAddress = authorEmailAddress {
byline += "<\(emailAddress)>" // TODO: mailto link
}
else if let url = author.url {

View File

@ -134,17 +134,22 @@ extension Article {
byline += ", "
}
isFirstAuthor = false
var authorEmailAddress: String? = nil
if let emailAddress = author.emailAddress, !(emailAddress.contains("noreply@") || emailAddress.contains("no-reply@")) {
authorEmailAddress = emailAddress
}
if let emailAddress = author.emailAddress, emailAddress.contains(" ") {
if let emailAddress = authorEmailAddress, emailAddress.contains(" ") {
byline += emailAddress // probably name plus email address
}
else if let name = author.name, let emailAddress = author.emailAddress {
else if let name = author.name, let emailAddress = authorEmailAddress {
byline += "\(name) <\(emailAddress)>"
}
else if let name = author.name {
byline += name
}
else if let emailAddress = author.emailAddress {
else if let emailAddress = authorEmailAddress {
byline += "<\(emailAddress)>"
}
else if let url = author.url {