Renders the weekly digest and the monthly recap, as the drafts approved
them: the weekly one has four sections (what happened to the reader, what
the people and playlists they follow posted, the period's top dumps, and
the community), the monthly one only the last two. digest-service.ts
gathers a DigestContent and sends what this returns, drawn in the
reader's own style and scheme.
Returns the digest content describes, written as Markdown and drawn in
look, with its subject and hidden preheader.
Passed to renderDigestEmail by digest-service.ts. Each section is
null when it has nothing to show, and is left out; the service sends
nothing when all of them are.
-
activity: { counts: Partial<Record<ActivityKind, number>>; highlights: DigestHighlight[]; total: number; }
| nullWeekly only.
- cadence: DigestCadence
-
community: { members: { username: string; invitedBy: string | null; }[]; membersMore: number; playlists: { title: string; url: string; owner: string; dumps: number; }[]; playlistsMore: number; chatMessages: number; totals: { dumps: number; upvotes: number; comments: number; }; }
| null -
from: Date
The period covered, from
fromtoto. - links: { notifications: string; followed: string; chat: string; community: string; settings: string; unsubscribe: string; }
-
network: { dumps: DigestDump[]; more: number; } | null
Weekly only.
- reader: string
- to: Date
- top: DigestDump[]
A dump in a digest's lists, with its links made absolute.
-
addedTo: string
The followed playlist it was added to, when that's why it's listed.
- comments: number
-
domain: string | null
The link's host, or null for an upload.
-
mine: boolean
Posted by the reader, which the lists mark.
- poster: string
-
thumbnail: string | null
An absolute image URL, or null to show no image.
- title: string
- url: string
- votes: number
One line of the weekly digest's "For you", made from a notification.
- at: Date
- kind: HighlightKind
-
quote: string
The comment or message, flattened and shortened.
-
target: { title: string; url: string | null; }
What they did it on, absent for a follow of the reader or the chat. Its
urlis null once it is deleted, and the title then shows unlinked. -
who: string
Who did it.
| "followers"
| "comments"
| "mentions"
| "likes"
| "playlistFollows"
The kinds of activity a weekly digest counts.
| "mentionDump"
| "mentionPlaylist"
| "mentionChat"
| "mentionEveryone"
| "comment"
| "playlistFollow"
| "userFollow"
| "commentLike"
What a highlight of the weekly digest says happened.
Usage
import * as mod from "api/mail/digest.ts";