moderator-toolbox-nxg-for-reddit / modules/queuetools/components/hooks

modules/queuetools/components/hooks

Functions

useItemActions()

useItemActions(context, deps, enabled): ItemActions | null

Defined in: extension/data/modules/queuetools/components/hooks.ts:69

Loads the recent mod-log actions for a queue item, gated on the current user moderating the item’s subreddit. Returns null while loading or when there is nothing to show.

Parameters

context

UILocationContext

UILocationContext for the current queue item.

deps

Factory-provided data accessors.

checkIsMod

(subreddit) => Promise<boolean>

getActions

GetActions

getThingData

(thingId) => Promise<Record<string, unknown>>

enabled

boolean

Whether the recent-actions feature is enabled; when false the hook does no fetching.

Returns

ItemActions | null


useItemReports()

useItemReports(context, getReports, enabled): IgnoredReportData | null

Defined in: extension/data/modules/queuetools/components/hooks.ts:148

Loads the ignored mod/user reports for a queue item. Returns null while loading or when the item has no reports to surface.

Parameters

context

UILocationContext

UILocationContext for the current queue item.

getReports

(subreddit, thingId) => Promise<IgnoredReportData | null>

Factory-provided fetch returning ignored-report data, or null when not applicable.

enabled

boolean

Whether the reports feature is enabled; when false the hook does no fetching.

Returns

IgnoredReportData | null

Interfaces

IgnoredReportData

Defined in: extension/data/modules/queuetools/components/hooks.ts:21

Mod/user report lists for a queue item whose reports have been ignored.

Properties

modReports

modReports: [string, string][]

Defined in: extension/data/modules/queuetools/components/hooks.ts:22

userReports

userReports: [string, string][]

Defined in: extension/data/modules/queuetools/components/hooks.ts:23


ItemActions

Defined in: extension/data/modules/queuetools/components/hooks.ts:27

Resolved recent-actions data for a queue item, ready to render as a table.

Properties

actions

actions: Record<string, ActionEntry>

Defined in: extension/data/modules/queuetools/components/hooks.ts:28

postStateEntry

postStateEntry: ActionEntry | null

Defined in: extension/data/modules/queuetools/components/hooks.ts:29

Type Aliases

GetActions

GetActions = (subreddit, fullName, callback) => void

Defined in: extension/data/modules/queuetools/components/hooks.ts:14

Callback signature for the getActions function provided by the dom.ts factory. Returns cached mod-log actions for a queue item, fetching from the API if needed.

Parameters

subreddit

string

fullName

string

callback

(result) => void

Returns

void