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

modules/removalreasons/proposalAdapter

Functions

freezeRemovalParams()

freezeRemovalParams(params, selection?): FrozenRemovalIntent

Defined in: extension/data/modules/removalreasons/proposalAdapter.ts:32

Snapshots resolved removal params into the curated frozen intent, omitting empty/ default fields and nesting the optional flair/usernote/ban/log steps so a captured proposal carries only what replay needs. The item’s own metadata is NOT stored - it is re-fetched at replay from the proposal’s itemId (see thawRemovalIntent).

Parameters

params

SubmitRemovalParams

The fully-composed params the overlay would pass to submitRemoval.

selection?

FrozenRemovalSelection

The trainee’s structured reason selection, captured in addition to the composed reasonText purely to re-seed the overlay for Edit & Accept. Stored only when it has reasons; replay and display never read it.

Returns

FrozenRemovalIntent


replayRemovalProposal()

replayRemovalProposal(subreddit, proposal, intent, overrides?): Promise<void>

Defined in: extension/data/modules/removalreasons/proposalAdapter.ts:155

Replays a frozen removal-reason intent by reconstructing the params (re-fetching item metadata) and running the real submission pipeline inside an authorized replay context. Throws on a pipeline failure so the caller (the gateway) records needs_attention rather than marking the proposal accepted.

Parameters

subreddit

string

The subreddit the proposal belongs to.

proposal

Proposal

The proposal being replayed.

intent

FrozenRemovalIntent

The frozen removal intent captured at propose time.

overrides?

Reviewer edits applied at accept time (accept-with-edit); currently the composed reason text only. Omit to replay the captured intent verbatim.

reasonText?

string

Returns

Promise<void>