moderator-toolbox-nxg-for-reddit / modules/massmoderation/oldReddit/queueModtools

modules/massmoderation/oldReddit/queueModtools

Functions

createMassModerationSetup()

createMassModerationSetup(): object

Defined in: extension/data/modules/massmoderation/oldReddit/queueModtools.tsx:134

Sets up the “queue tools” tab in the old Reddit tab menu for applicable page types. Performs DOM queries and location provisioning; call lifecycle.mount(setup.cleanup) in index.ts.

Returns

object

{hasQueueToolsTab, cleanup} - hasQueueToolsTab indicates whether the tab was injected.

hasQueueToolsTab

hasQueueToolsTab: boolean

cleanup()

cleanup(): void

Returns

void


createModtoolsActivator()

createModtoolsActivator(module, options): () => { cleanup: () => Promise<void>; sidebarSort: { handleSortClick: (() => void) | null; }; syncModlogActions: () => Promise<number>; handleNewThings: void; handlePrettyButton: void; handleReportedStamp: void; handleThingCheckbox: void; handleThingEntry: void; } | null

Defined in: extension/data/modules/massmoderation/oldReddit/queueModtools.tsx:175

Returns a one-shot activate() function that calls createModtoolsHandlers exactly once. The activated state is held in the factory closure, so index.ts needs no guard variable.

Parameters

module

Module<MassModerationSettings>

options

MassModerationSettings

Returns

A function that returns the handler bundle on first call, null on subsequent calls.

() => { cleanup: () => Promise<void>; sidebarSort: { handleSortClick: (() => void) | null; }; syncModlogActions: () => Promise<number>; handleNewThings: void; handlePrettyButton: void; handleReportedStamp: void; handleThingCheckbox: void; handleThingEntry: void; } | null


createModtoolsHandlers()

createModtoolsHandlers(module, __namedParameters): object

Defined in: extension/data/modules/massmoderation/oldReddit/queueModtools.tsx:189

Initializes the Mass Moderation toolbar and queue-level handlers for an old Reddit page.

Parameters

module

Module<MassModerationSettings>

The MassModeration module instance (used to persist settings changes).

__namedParameters

MassModerationSettings

Returns

An object of event handlers to be wired into the module lifecycle.

cleanup

cleanup: () => Promise<void>

Returns

Promise<void>

sidebarSort

sidebarSort: object

sidebarSort.handleSortClick

handleSortClick: (() => void) | null

syncModlogActions

syncModlogActions: () => Promise<number>

Reconciles the queue with the recent mod log (actions by other mods, or yourself elsewhere).

Fetches the recent moderation log and reconciles the queue with actions taken elsewhere - by other mods, or by this user on another queue page. Each queue item newly approved/removed/ spammed gets the matching color, its action buttons replaced with an “Approved/Removed by ” status, and the modbar count decremented. Items already actioned locally (or reconciled on a previous run) carry the toolbox-modlog-actioned marker and are skipped so each counts once.

The first run an item is present for only establishes its baseline (toolbox-modlog-baselined): much of the queue is there because something already removed it - AutoModerator, the spam filter, or reddit itself - and the page HTML was rendered with that state, so treating those log entries as fresh actions would recolor untouched items and decrement the count for them. Only an entry that appears after an item has been seen without one is a real new action.

Returns

Promise<number>

The number of items newly reconciled on this run (0 if the fetch is skipped or fails).

handleNewThings()

handleNewThings(): void

Processes any newly-added queue items that haven’t been seen yet.

Returns

void

handlePrettyButton()

handlePrettyButton(button): void

Hides or marks items after a per-item pretty-button action.

Parameters
button

Element

Returns

void

handleReportedStamp()

handleReportedStamp(stampEl): void

Selects the item when the user clicks its reported-stamp.

Parameters
stampEl

Element

Returns

void

handleThingCheckbox()

handleThingCheckbox(): void

Syncs toolbar selection state when any checkbox changes.

Returns

void

handleThingEntry()

handleThingEntry(entryEl, event): void

Selects the item when the user clicks anywhere on a thing’s entry row.

Parameters
entryEl

Element

event

MouseEvent

Returns

void

Type Aliases

ModtoolsHandlers

ModtoolsHandlers = ReturnType<typeof createModtoolsHandlers>

Defined in: extension/data/modules/massmoderation/oldReddit/queueModtools.tsx:895

The handler bundle returned by createModtoolsHandlers.