mirror of
https://github.com/juherr/kill-the-news.git
synced 2026-06-20 22:03:48 +00:00
refactor(feed): drop unused aggregate getter, dedupe sender parse
The sender-in-title rendering reads the FeedConfig DTO via the read model, so the Feed.senderInTitle getter had no consumer — remove it. In buildFeed, parse the from-address once and reuse it for both the title prefix and the author; drop the dead `?? email.from` fallback (parseFromAddress already returns the address as the name). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -138,11 +138,6 @@ export class Feed {
|
|||||||
return this._state.language;
|
return this._state.language;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Whether entry titles render as `[Sender] Subject` in the feed output. */
|
|
||||||
get senderInTitle(): boolean {
|
|
||||||
return this._state.senderInTitle ?? false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** The inbound mailbox (`noun.noun.NN`) — the feed's email address is `mailboxId@domain`. */
|
/** The inbound mailbox (`noun.noun.NN`) — the feed's email address is `mailboxId@domain`. */
|
||||||
get mailboxId(): MailboxId {
|
get mailboxId(): MailboxId {
|
||||||
return MailboxId.unchecked(this._state.mailboxId);
|
return MailboxId.unchecked(this._state.mailboxId);
|
||||||
|
|||||||
@@ -74,17 +74,17 @@ function buildFeed(
|
|||||||
baseUrl,
|
baseUrl,
|
||||||
EmailAddress.parse(email.from)?.siteBaseUrl() ?? "",
|
EmailAddress.parse(email.from)?.siteBaseUrl() ?? "",
|
||||||
);
|
);
|
||||||
|
const sender = parseFromAddress(email.from);
|
||||||
const subject = htmlToText(email.subject);
|
const subject = htmlToText(email.subject);
|
||||||
const title = feedConfig.sender_in_title
|
|
||||||
? `[${parseFromAddress(email.from).name ?? email.from}] ${subject}`
|
|
||||||
: subject;
|
|
||||||
feed.addItem({
|
feed.addItem({
|
||||||
title,
|
title: feedConfig.sender_in_title
|
||||||
|
? `[${sender.name}] ${subject}`
|
||||||
|
: subject,
|
||||||
id: entryUrl,
|
id: entryUrl,
|
||||||
link: entryUrl,
|
link: entryUrl,
|
||||||
description: bodyContent,
|
description: bodyContent,
|
||||||
content: bodyContent,
|
content: bodyContent,
|
||||||
author: [parseFromAddress(email.from)],
|
author: [sender],
|
||||||
date: new Date(email.receivedAt),
|
date: new Date(email.receivedAt),
|
||||||
enclosure: firstAttachment
|
enclosure: firstAttachment
|
||||||
? {
|
? {
|
||||||
|
|||||||
Reference in New Issue
Block a user