moderator-toolbox-nxg-for-reddit / modules/profile/components/BulkRemovePanel.helpers

modules/profile/components/BulkRemovePanel.helpers

Functions

bulkRemoveUserContent()

bulkRemoveUserContent(subreddit, user, opts): Promise<void>

Defined in: extension/data/modules/profile/components/BulkRemovePanel.helpers.ts:40

Scans a user’s full overview history and removes every non-removed item that belongs to subreddit. Errors propagate to the caller (the panel logs them).

The fetched items aren’t DOM-attached, so the training-mode capture guard can’t resolve their subreddit from the fullname. Every kept item is in subreddit (filtered below), so we register that mapping for the guard before each removal and clean it up after - mirroring the modbutton bulk-remove path. Without this, a trainee sandboxed in some OTHER subreddit would trip the guard’s “unresolved sub + sandboxed somewhere” fail-closed branch on the first removal and abort the whole scan, even though the target subreddit isn’t sandboxed. (A trainee sandboxed in subreddit itself is refused upfront by the panel, so the loop never runs for them.)

Parameters

subreddit

string

Target subreddit; only this subreddit’s items are removed.

user

string

Reddit username whose content is being removed.

opts

BulkRemoveOptions

Cancellation and progress callbacks.

Returns

Promise<void>

Interfaces

BulkRemoveOptions

Defined in: extension/data/modules/profile/components/BulkRemovePanel.helpers.ts:16

Options controlling and observing a bulkRemoveUserContent run.

Properties

isCancelled

isCancelled: () => boolean

Defined in: extension/data/modules/profile/components/BulkRemovePanel.helpers.ts:18

Polled before each page and each item; return true to stop the scan early.

Returns

boolean

onProgress

onProgress: (progress) => void

Defined in: extension/data/modules/profile/components/BulkRemovePanel.helpers.ts:20

Called after each page is scanned and after each successful removal.

Parameters
progress

BulkRemoveProgress

Returns

void


BulkRemoveProgress

Defined in: extension/data/modules/profile/components/BulkRemovePanel.helpers.ts:8

Running totals reported back to the panel as the scan progresses.

Properties

removed

removed: number

Defined in: extension/data/modules/profile/components/BulkRemovePanel.helpers.ts:12

How many items have actually been removed so far.

scanned

scanned: number

Defined in: extension/data/modules/profile/components/BulkRemovePanel.helpers.ts:10

How many history items have been scanned so far (across all subreddits).