moderator-toolbox-nxg-for-reddit / modules/shared/modnotes/schema

modules/shared/modnotes/schema

Interfaces

ModNote

Defined in: extension/data/modules/shared/modnotes/schema.ts:115

A single mod note as returned by the Reddit API.

Properties

created_at

created_at: number

Defined in: extension/data/modules/shared/modnotes/schema.ts:117

description

description: string | null

Defined in: extension/data/modules/shared/modnotes/schema.ts:123

details

details: string | null

Defined in: extension/data/modules/shared/modnotes/schema.ts:124

id

id: string

Defined in: extension/data/modules/shared/modnotes/schema.ts:116

label

label: string | null

Defined in: extension/data/modules/shared/modnotes/schema.ts:122

mod_action_data

mod_action_data: ModNoteModActionData | null

Defined in: extension/data/modules/shared/modnotes/schema.ts:126

operator

operator: string

Defined in: extension/data/modules/shared/modnotes/schema.ts:119

subreddit

subreddit: string

Defined in: extension/data/modules/shared/modnotes/schema.ts:120

type

type: string

Defined in: extension/data/modules/shared/modnotes/schema.ts:118

user

user: string

Defined in: extension/data/modules/shared/modnotes/schema.ts:121

user_note_data

user_note_data: ModNoteUserNoteData | null

Defined in: extension/data/modules/shared/modnotes/schema.ts:125


ModNoteModActionData

Defined in: extension/data/modules/shared/modnotes/schema.ts:105

Mod-action-specific fields on a mod note.

Properties

action

action: string

Defined in: extension/data/modules/shared/modnotes/schema.ts:107

The mod action taken (e.g. 'removelink').

description

description: string | null

Defined in: extension/data/modules/shared/modnotes/schema.ts:109

details

details: string | null

Defined in: extension/data/modules/shared/modnotes/schema.ts:108

reddit_id

reddit_id: string | null

Defined in: extension/data/modules/shared/modnotes/schema.ts:111

Fullname of the Reddit item the action was taken on, or null.


ModNoteUserNoteData

Defined in: extension/data/modules/shared/modnotes/schema.ts:95

User-note-specific fields on a mod note.

Properties

label

label: string | null

Defined in: extension/data/modules/shared/modnotes/schema.ts:99

Label type string (e.g. 'BAN'), or null.

note

note: string

Defined in: extension/data/modules/shared/modnotes/schema.ts:97

Free-text note body.

reddit_id

reddit_id: string | null

Defined in: extension/data/modules/shared/modnotes/schema.ts:101

Fullname of the Reddit item this note is attached to, or null.


PendingNoteRequest

Defined in: extension/data/modules/shared/modnotes/schema.ts:130

An in-flight batch request for a user’s latest mod note, held in the deferred queue.

Properties

reject

reject: (reason?) => void

Defined in: extension/data/modules/shared/modnotes/schema.ts:135

Parameters
reason?

unknown

Returns

void

resolve

resolve: (value) => void

Defined in: extension/data/modules/shared/modnotes/schema.ts:134

Resolves the promise with the fetched note or null when none exists.

Parameters
value

ModNote | null

Returns

void

subreddit

subreddit: string

Defined in: extension/data/modules/shared/modnotes/schema.ts:131

user

user: string

Defined in: extension/data/modules/shared/modnotes/schema.ts:132

Variables

defaultNoteLabelValueToLabelType

const defaultNoteLabelValueToLabelType: Record<string, string | undefined>

Defined in: extension/data/modules/shared/modnotes/schema.ts:48

Maps defaultNoteLabel setting values to API label type strings.


labelColors

const labelColors: Record<string, string>

Defined in: extension/data/modules/shared/modnotes/schema.ts:17

Maps label type strings to CSS color values for display.


labelNames

const labelNames: Record<string, string>

Defined in: extension/data/modules/shared/modnotes/schema.ts:30

Maps label type strings to human-readable display names.


labelTypeToUsernoteType

const labelTypeToUsernoteType: Record<string, string | undefined>

Defined in: extension/data/modules/shared/modnotes/schema.ts:82

Reverse of usernoteTypeToLabelType, for carrying a chosen label back to a Toolbox note type when a note’s destination is switched to the wiki. Reddit’s USER_SUMMARY label is auto-generated and has no Toolbox counterpart, so it is absent and resolves to undefined (the note keeps no type).


maxNativeNoteLength

const maxNativeNoteLength: 250 = 250

Defined in: extension/data/modules/shared/modnotes/schema.ts:92

Character limit Reddit enforces on a mod note’s body. A longer note is rejected outright, so writers truncate to this rather than let the call fail.


selectableLabelNames

const selectableLabelNames: Record<string, string>

Defined in: extension/data/modules/shared/modnotes/schema.ts:43

Like labelNames but with the auto-generated USER_SUMMARY label excluded (not user-selectable).


typeNames

const typeNames: Record<string, string>

Defined in: extension/data/modules/shared/modnotes/schema.ts:4

Maps API note type strings to human-readable display names.


usernoteTypeToLabelType

const usernoteTypeToLabelType: Record<string, string | undefined>

Defined in: extension/data/modules/shared/modnotes/schema.ts:66

Maps Toolbox usernote type keys to API label type strings, for seeding a native note’s label from a removal reason’s default_note_type. Covers the built-in types only (defaultUsernoteTypes); a subreddit’s custom key has no Reddit counterpart and resolves to undefined, which leaves the note unlabelled.