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:
Julien Herr
2026-05-25 15:52:51 +02:00
parent 82a4bd8341
commit 16029460bc
2 changed files with 5 additions and 10 deletions
-5
View File
@@ -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);
+5 -5
View File
@@ -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
? { ? {