digest email: replace reply/reaction counts with posting relay URL #27

Merged
matt merged 1 commit from mailship-ihb-digest-email-replace-reply-reaction-coun-281 into main 2026-09-22 14:58:00 +00:00
Collaborator

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 relayByEventId map 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-item classes so styling (font, color, size) is identical.
  • src/digest.ts — getEventVariables now reads the relay URL from data.relayByEventId.get(event.id), normalizes it, and strips the wss:// prefix and trailing slash for display. The previous Replies/Reactions computation and its supporting code (spec, getParentId, repliesByParentId, context destructure) are removed.
  • script/render-preview.mjs — sample data updated from Replies/Reactions to RelayUrl.
  • test/digest-reply-stats.test.ts — assertion updated to check that parentEntry.RelayUrl contains the expected normalized relay domain.

How to test

Run pnpm run check (typecheck + lint) and pnpm run test:unit (vitest). The preview can be rendered with pnpm run preview:digest then opening digest-preview.html.

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 `relayByEventId` map 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-item` classes so styling (font, color, size) is identical. - **`src/digest.ts`** — `getEventVariables` now reads the relay URL from `data.relayByEventId.get(event.id)`, normalizes it, and strips the `wss://` prefix and trailing slash for display. The previous `Replies`/`Reactions` computation and its supporting code (`spec`, `getParentId`, `repliesByParentId`, `context` destructure) are removed. - **`script/render-preview.mjs`** — sample data updated from `Replies`/`Reactions` to `RelayUrl`. - **`test/digest-reply-stats.test.ts`** — assertion updated to check that `parentEntry.RelayUrl` contains the expected normalized relay domain. **How to test** Run `pnpm run check` (typecheck + lint) and `pnpm run test:unit` (vitest). The preview can be rendered with `pnpm run preview:digest` then opening `digest-preview.html`.
hudson added 1 commit 2026-09-22 14:05:58 +00:00
digest email: replace reply/reaction counts with relay URL
All checks were successful
CI / checks (pull_request) Successful in 39s
b7592044c0
- 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`
matt approved these changes 2026-09-22 14:57:57 +00:00
matt merged commit 27bb4a5342 into main 2026-09-22 14:58:00 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: matt/mailship#27
No description provided.