mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Merge pull request #1638 from omnivore-app/fix/no-author-in-newsletter
Fix the error when no name in subscription by using the email address as the author when no author found in the newsletter
This commit is contained in:
commit
4caeab251d
2 changed files with 6 additions and 1 deletions
|
|
@ -134,7 +134,7 @@ export abstract class ContentHandler {
|
|||
// e.g. 'Jackson Harper from Omnivore App <jacksonh@substack.com>'
|
||||
// or 'Mike Allen <mike@axios.com>'
|
||||
const parsed = addressparser(from)
|
||||
if (parsed.length > 0) {
|
||||
if (parsed.length > 0 && parsed[0].name) {
|
||||
return parsed[0].name
|
||||
}
|
||||
return from
|
||||
|
|
|
|||
|
|
@ -93,6 +93,11 @@ describe('Newsletter email test', () => {
|
|||
const from = 'Mike Allen <mike@axios.com>'
|
||||
expect(new AxiosHandler().parseAuthor(from)).to.equal('Mike Allen')
|
||||
})
|
||||
|
||||
it('returns email address if author is not there', () => {
|
||||
const from = 'mike@axios.com'
|
||||
expect(new AxiosHandler().parseAuthor(from)).to.equal(from)
|
||||
})
|
||||
})
|
||||
|
||||
describe('getNewsletterHandler', () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue