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

modules/removalreasons/schema

Functions

isDrawerDisplayMode()

isDrawerDisplayMode(displayMode): boolean

Defined in: extension/data/modules/removalreasons/schema.ts:21

Returns true when the given display mode string selects the drawer variant.

Parameters

displayMode

string | undefined

The raw display mode string from settings.

Returns

boolean

Interfaces

NativeReasonSyncState

Defined in: extension/data/modules/removalreasons/schema.ts:90

Per-subreddit state for syncing Reddit’s native removal reasons into the toolbox config. The sync is one-way: Reddit owns each linked reason’s title and message, while the toolbox-only extras (flair, usernote defaults, post/comment applicability) stay under moderator control.

This lives in the wiki config rather than in per-user settings on purpose: the fingerprint is shared, so the first moderator to notice a change upstream performs the single write and everyone else sees it already applied.

Properties

enabled?

optional enabled?: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:96

Whether the sync is enabled for this subreddit. Only ever written as true - turning the sync off removes this whole block rather than writing false, and takes the imported reasons with it, so re-enabling is always a full re-import.

fingerprint?

optional fingerprint?: string

Defined in: extension/data/modules/removalreasons/schema.ts:102

Digest of the native reason set as of the last applied sync, used to skip the merge entirely when nothing upstream has changed. Deliberately order-independent (see nativeReasonsFingerprint), so it changes only when a merge would do work.

ignored?

optional ignored?: string[]

Defined in: extension/data/modules/removalreasons/schema.ts:115

Native reason ids a moderator deleted locally. They are never re-imported, so deleting a synced reason in the toolbox editor sticks instead of reappearing on the next sync. Cleared along with the rest of this block when the sync is turned off, which is how a moderator undoes an ignore they did not mean.

lastSyncedAt?

optional lastSyncedAt?: number

Defined in: extension/data/modules/removalreasons/schema.ts:108

Epoch milliseconds of the last sync that actually changed something; displayed in the editor. Not a last-checked time: checks that find nothing new return without writing, so this stands still while the sync is working normally.


RemovalReason

Defined in: extension/data/modules/removalreasons/schema.ts:135

A single configured removal reason.

Properties

default_note?

optional default_note?: string

Defined in: extension/data/modules/removalreasons/schema.ts:164

Default note text to pre-fill when this reason is selected.

default_note_type?

optional default_note_type?: string

Defined in: extension/data/modules/removalreasons/schema.ts:166

Key of the usernote type (UserNoteColor.key) to pre-select.

editable?

optional editable?: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:162

When true, the moderator may edit this reason’s text before sending.

flairCSS

flairCSS: string

Defined in: extension/data/modules/removalreasons/schema.ts:159

flairTemplateID

flairTemplateID: string

Defined in: extension/data/modules/removalreasons/schema.ts:160

flairText

flairText: string

Defined in: extension/data/modules/removalreasons/schema.ts:158

id?

optional id?: string

Defined in: extension/data/modules/removalreasons/schema.ts:140

Stable identifier (schema v2+), assigned by ensureStableIds and stripped from the classic v1 mirror. Optional because runtime data may predate it.

nativeReasonId?

optional nativeReasonId?: string

Defined in: extension/data/modules/removalreasons/schema.ts:178

Reddit’s reason id, set when this reason comes from Reddit’s own removal reasons rather than being written in toolbox. It is registered against the removed item via the modactions API on submit, so the removal also lands in Reddit’s mod log.

Set on two kinds of reason: the ephemeral ones synthesized when a subreddit has no toolbox reasons at all (see the nativeReasonsFallback setting), and the persisted ones imported by the opt-in sync (see NativeReasonSyncState). On a persisted reason it is the sync link, so it must survive edits and the legacy mirror round-trip - dropping it orphans the reason and the next sync re-imports a duplicate.

removeComments?

optional removeComments?: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:157

Tri-state comment applicability: true always shows the reason for comments, absent defers to the mod’s “enable removal reasons for comments” setting, and explicit false (written by 6.x saves, never by the NXG editor) always hides it.

removePosts?

optional removePosts?: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:150

When false, this reason is hidden for posts.

text

text: string

Defined in: extension/data/modules/removalreasons/schema.ts:147

Markdown body of the removal message. May contain substitution tokens ({subreddit}, …) and interactive fill-in tokens ({input: ...}, {textarea: ...}, and a {choice} block whose options are the markdown list below the marker).

title

title: string

Defined in: extension/data/modules/removalreasons/schema.ts:148


RemovalReasonsConfig

Defined in: extension/data/modules/removalreasons/schema.ts:29

The removal-reasons configuration block stored in the subreddit’s toolbox wiki config. All fields except reasons are optional because older configs may omit them.

Properties

autoArchive?

optional autoArchive?: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:62

Whether modmail threads are auto-archived after sending by default.

editableReasonsEnabled?

optional editableReasonsEnabled?: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:66

When true, moderators may edit reason text before sending.

getfrom?

optional getfrom?: string

Defined in: extension/data/modules/removalreasons/schema.ts:40

Name of another subreddit whose removal reasons to use instead. Resolved recursively by getRemovalReasons.

logreason?

optional logreason?: string

Defined in: extension/data/modules/removalreasons/schema.ts:48

Default reason text pre-filled in the log post, supports token substitution.

logsub?

optional logsub?: string

Defined in: extension/data/modules/removalreasons/schema.ts:44

Subreddit to post the removal log to.

logtitle?

optional logtitle?: string

Defined in: extension/data/modules/removalreasons/schema.ts:46

Title template for the removal log post, supports token substitution.

nativeSync?

optional nativeSync?: NativeReasonSyncState

Defined in: extension/data/modules/removalreasons/schema.ts:77

State for the one-way import of Reddit’s native removal reasons into this config. NXG-only; stripped from the legacy v1 mirror in encodeClassicConfig.

pmsubject?

optional pmsubject?: string

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

Subject line template for removal PMs, supports token substitution.

reasons

reasons: RemovalReason[]

Defined in: extension/data/modules/removalreasons/schema.ts:31

The list of configured removal reasons.

removalOption?

optional removalOption?: string

Defined in: extension/data/modules/removalreasons/schema.ts:50

How the removal option is presented: 'suggest', 'force', or 'leave'.

suggestedReasons?

optional suggestedReasons?: SuggestedReasonMapping[]

Defined in: extension/data/modules/removalreasons/schema.ts:72

Mappings from a report reason to removal reason(s), so a matching report pre-selects (and optionally one-click applies) those reasons in the queue. NXG-only; stripped from the legacy v1 mirror in encodeClassicConfig.

typeAsSub?

optional typeAsSub?: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:60

Whether the removal message is sent via modmail as the subreddit by default.

typeCommentAsSubreddit?

optional typeCommentAsSubreddit?: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:58

Whether the reply is sent as the subreddit by default.

typeLockComment?

optional typeLockComment?: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:56

Whether the reply locks the removed comment by default.

typeLockThread?

optional typeLockThread?: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:64

Whether the target thread is locked after removal by default.

typeReply?

optional typeReply?: string

Defined in: extension/data/modules/removalreasons/schema.ts:52

Default reply type: 'reply', 'pm', 'both', etc.

typeStickied?

optional typeStickied?: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:54

Whether the reply is stickied by default.


RemovalReasonsData

Defined in: extension/data/modules/removalreasons/schema.ts:182

Runtime context data for a thing being removed, passed to the overlay.

Properties

author

author: string

Defined in: extension/data/modules/removalreasons/schema.ts:188

autoArchive?

optional autoArchive?: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:241

body

body: string

Defined in: extension/data/modules/removalreasons/schema.ts:201

Rendered plain-text body.

communityDescription?

optional communityDescription?: string

Defined in: extension/data/modules/removalreasons/schema.ts:227

The subreddit’s public description, for Reddit’s {community_description} macro.

communityRules?

optional communityRules?: string[]

Defined in: extension/data/modules/removalreasons/schema.ts:232

The subreddit’s rules in moderator-configured order, for Reddit’s positional {community_rule_1} macros. Each entry is already rendered as the macro presents it.

communityTitle?

optional communityTitle?: string

Defined in: extension/data/modules/removalreasons/schema.ts:225

The subreddit’s display title, for Reddit’s {community_name} macro. Fetched only when a reason actually uses one of the community macros, so it is absent on most removals - and an absent value leaves the macro as literal text rather than blanking it.

domain

domain: string

Defined in: extension/data/modules/removalreasons/schema.ts:199

editableReasonsEnabled?

optional editableReasonsEnabled?: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:244

footer

footer: string

Defined in: extension/data/modules/removalreasons/schema.ts:215

Footer markdown appended to the message.

fullname

fullname: string

Defined in: extension/data/modules/removalreasons/schema.ts:185

Reddit fullname (e.g. t3_abc123).

header

header: string

Defined in: extension/data/modules/removalreasons/schema.ts:213

Header markdown prepended to the message.

id

id: string

Defined in: extension/data/modules/removalreasons/schema.ts:187

Bare base-36 id (e.g. abc123); handy for building URLs.

kind

kind: string

Defined in: extension/data/modules/removalreasons/schema.ts:192

'submission' or 'comment'.

logReason

logReason: string

Defined in: extension/data/modules/removalreasons/schema.ts:211

Pre-filled log reason text.

logSub

logSub: string

Defined in: extension/data/modules/removalreasons/schema.ts:217

Log subreddit name, if removal logging is configured.

logTitle

logTitle: string

Defined in: extension/data/modules/removalreasons/schema.ts:219

Title template for the log post.

mod

mod: string

Defined in: extension/data/modules/removalreasons/schema.ts:194

Username of the acting moderator.

raw_body

raw_body: string

Defined in: extension/data/modules/removalreasons/schema.ts:203

Raw markdown body.

reasons

reasons: RemovalReason[]

Defined in: extension/data/modules/removalreasons/schema.ts:243

removalOption?

optional removalOption?: string

Defined in: extension/data/modules/removalreasons/schema.ts:234

How delivery settings apply to other mods: 'suggest', 'force', or 'leave'.

subject

subject: string

Defined in: extension/data/modules/removalreasons/schema.ts:209

Subject line for Modmail delivery, may contain tokens.

subreddit

subreddit: string

Defined in: extension/data/modules/removalreasons/schema.ts:183

title

title: string

Defined in: extension/data/modules/removalreasons/schema.ts:190

Post or comment title (empty string for comments).

typeAsSub?

optional typeAsSub?: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:240

Whether to send via modmail as the subreddit.

typeCommentAsSubreddit?

optional typeCommentAsSubreddit?: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:237

typeLockComment?

optional typeLockComment?: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:238

typeLockThread?

optional typeLockThread?: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:242

typeReply?

optional typeReply?: string

Defined in: extension/data/modules/removalreasons/schema.ts:235

typeStickied?

optional typeStickied?: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:236

uri_body

uri_body: string

Defined in: extension/data/modules/removalreasons/schema.ts:205

URL-encoded body.

uri_title

uri_title: string

Defined in: extension/data/modules/removalreasons/schema.ts:207

URL-encoded title.

url

url: string

Defined in: extension/data/modules/removalreasons/schema.ts:196

Permalink of the thing.


RemovalReasonsOverlaySettings

Defined in: extension/data/modules/removalreasons/schema.ts:248

Personal default delivery settings applied when the subreddit leaves options up to each moderator.

Properties

actionLockCommentSetting

actionLockCommentSetting: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:256

actionLockSetting

actionLockSetting: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:255

reasonAsSubSetting

reasonAsSubSetting: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:251

reasonAutoArchiveSetting

reasonAutoArchiveSetting: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:252

reasonCommentAsSubredditSetting

reasonCommentAsSubredditSetting: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:254

reasonStickySetting

reasonStickySetting: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:253

reasonTypeSetting

reasonTypeSetting: string

Defined in: extension/data/modules/removalreasons/schema.ts:250

Default delivery method from the module settings selector.


SuggestedReasonMapping

Defined in: extension/data/modules/removalreasons/schema.ts:123

Maps a report reason to one or more removal reasons. When a queue item carries a report whose text matches pattern, the referenced reasons are pre-selected in the removal overlay.

Properties

id?

optional id?: string

Defined in: extension/data/modules/removalreasons/schema.ts:125

Stable identifier (assigned by ensureStableIds); optional because hand-edited configs may omit it.

includeUserReports?

optional includeUserReports?: boolean

Defined in: extension/data/modules/removalreasons/schema.ts:129

When true, user reports are also matched; otherwise only mod/bot reports are considered.

pattern

pattern: string

Defined in: extension/data/modules/removalreasons/schema.ts:127

The report-reason text to look for, matched as a case-insensitive substring.

reasonIds

reasonIds: string[]

Defined in: extension/data/modules/removalreasons/schema.ts:131

Stable ids of the removal reasons to suggest.

Type Aliases

NoteDestination

NoteDestination = "toolbox" | "native"

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

Where a note left during a removal is written: the Toolbox usernotes wiki, or Reddit’s own mod notes. Either/or - a removal never writes both.


RemovalReasonsDisplayMode

RemovalReasonsDisplayMode = "Drawer" | "Popup (legacy)"

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

How the removal reasons overlay is presented to the moderator.

Variables

defaultLogTitle

const defaultLogTitle: "Removed: {kind} by /u/{author} to /r/{subreddit}" = 'Removed: {kind} by /u/{author} to /r/{subreddit}'

Defined in: extension/data/modules/removalreasons/schema.ts:6

Default log-post title, supports token substitution.


defaultSubject

const defaultSubject: "Your {kind} was removed from /r/{subreddit}" = 'Your {kind} was removed from /r/{subreddit}'

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

Default Modmail subject line when none is configured, supports token substitution.