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

modules/removalreasons/suggested

Functions

extractReportReasons()

extractReportReasons(thingElement): ExtractedReport[]

Defined in: extension/data/modules/removalreasons/suggested.ts:37

Extracts the report reasons attached to a queue item across both Reddit flavors. Returns an empty array when the element isn’t a queue item or carries no reports.

Parameters

thingElement

Element | null | undefined

The thing/queue-item element (or a descendant) being removed.

Returns

ExtractedReport[]


matchSuggestedReasons()

matchSuggestedReasons(reports, mappings): string[]

Defined in: extension/data/modules/removalreasons/suggested.ts:84

Resolves which removal reason ids a subreddit’s mappings suggest for a set of extracted reports. Reports from any mod/bot are considered; user reports are skipped unless the mapping opts in, and the pattern is matched as a case-insensitive substring. Returns de-duplicated reason ids in mapping order (and reason order within each mapping).

Parameters

reports

ExtractedReport[]

The reports extracted from the queue item.

mappings

SuggestedReasonMapping[] | undefined

The subreddit’s configured suggested-reason mappings.

Returns

string[]

Interfaces

ExtractedReport

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

A single report extracted from a queue item, tagged by where it came from.

Properties

reporter

reporter: string

Defined in: extension/data/modules/removalreasons/suggested.ts:19

The reporting mod/bot’s name, or '' when unknown (user reports, anonymized).

source

source: "user" | "mod"

Defined in: extension/data/modules/removalreasons/suggested.ts:17

'mod' for a moderator/bot report, 'user' for a user report.

text

text: string

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

The report reason text to match against.