moderator-toolbox-nxg-for-reddit / modules/modmail/schema

modules/modmail/schema

Functions

normalizeRecentActivity()

normalizeRecentActivity(map, kind): SidebarActivityItem[]

Defined in: extension/data/modules/modmail/schema.ts:42

Defensively narrows one of the recent* maps from the modmail /user response into a date-descending list of view rows. Untyped/malformed entries are skipped rather than thrown.

Parameters

map

unknown

The raw keyed map (recentPosts, recentComments, or recentConvos).

kind

SidebarActivityKind

Which map this is, selecting how title/body are derived.

Returns

SidebarActivityItem[]

Interfaces

SidebarActivityItem

Defined in: extension/data/modules/modmail/schema.ts:7

A single normalized row rendered in the user-sidebar activity panel.

Properties

body?

optional body?: string

Defined in: extension/data/modules/modmail/schema.ts:17

Comment body, present only for comment rows.

date?

optional date?: Date

Defined in: extension/data/modules/modmail/schema.ts:19

Parsed timestamp, when the entry carried a valid date.

id

id: string

Defined in: extension/data/modules/modmail/schema.ts:9

Stable key for the row (the source map’s key: a fullname or conversation id).

subreddit?

optional subreddit?: string

Defined in: extension/data/modules/modmail/schema.ts:15

Subreddit the post/comment belongs to, when present.

title

title: string

Defined in: extension/data/modules/modmail/schema.ts:11

Primary line: post title, the comment’s post title, or the conversation subject.

Type Aliases

SidebarActivityKind

SidebarActivityKind = "post" | "comment" | "convo"

Defined in: extension/data/modules/modmail/schema.ts:4

Which kind of recent-activity map an entry came from, controlling how its fields map onto the view model.