digest email: replace reply/reaction counts with posting relay URL #27
Loading…
Reference in a new issue
No description provided.
Delete branch "mailship-ihb-digest-email-replace-reply-reaction-coun-281"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
bead-id: mailship-ihb
Replace the per-event reply/reaction counts in the digest email template with a single item showing the relay the event was posted to, surfaced from the existing
relayByEventIdmap that was already populated but only used for event link construction.Changes
src/emails/digest.mjml— the two<span class="stat-item">{{Replies}} replies</span>/<span class="stat-item">{{Reactions}} reactions</span>lines are replaced by a single<span class="stat-item">Posted to {{RelayUrl}}</span>, using the same.event-stats/.stat-itemclasses so styling (font, color, size) is identical.src/digest.ts—getEventVariablesnow reads the relay URL fromdata.relayByEventId.get(event.id), normalizes it, and strips thewss://prefix and trailing slash for display. The previousReplies/Reactionscomputation and its supporting code (spec,getParentId,repliesByParentId,contextdestructure) are removed.script/render-preview.mjs— sample data updated fromReplies/ReactionstoRelayUrl.test/digest-reply-stats.test.ts— assertion updated to check thatparentEntry.RelayUrlcontains the expected normalized relay domain.How to test
Run
pnpm run check(typecheck + lint) andpnpm run test:unit(vitest). The preview can be rendered withpnpm run preview:digestthen openingdigest-preview.html.- Replace `{{Replies}}`/`{{Reactions}}` stat items in digest.mjml with a single `{{RelayUrl}}` item showing the posting relay domain - src/digest.ts: add `RelayUrl` to template variables, derive from existing `relayByEventId` map; strip unused `spec`, `getParentId`, `repliesByParentId`, and `context` destructure - test/digest-reply-stats.test.ts: update assertion to check `parentEntry.RelayUrl` instead of `Replies`/`Reactions` - script/render-preview.mjs: update sample data to use `RelayUrl`