moderator-toolbox-nxg-for-reddit / util/wiki/schemas/config/reconcile
util/wiki/schemas/config/reconcile¶
Functions¶
adoptLegacyConfigFields()¶
adoptLegacyConfigFields(
nxg,legacy):ToolboxConfig
Defined in: extension/data/util/wiki/schemas/config/reconcile.ts:108
Returns a copy of the NXG config with the 6.x-owned fields replaced by the
legacy config’s values. Stable ids on removal reasons and macros are
preserved by content-matching against the NXG entries (the legacy mirror
carries no ids); genuinely new entries get fresh ids. NXG-only keys (ver,
layout metadata, anything outside the owned fields) are untouched.
Parameters¶
nxg¶
The canonical normalized NXG config.
legacy¶
The normalized legacy config to adopt 6.x edits from.
Returns¶
legacyOwnedFieldsEqual()¶
legacyOwnedFieldsEqual(
nxg,legacy):boolean
Defined in: extension/data/util/wiki/schemas/config/reconcile.ts:70
Returns true when the 6.x-owned fields of two normalized configs agree,
ignoring stable ids (which the legacy round-trip strips).
Parameters¶
nxg¶
legacy¶
Returns¶
boolean
reconcileConfigFromLegacy()¶
reconcileConfigFromLegacy(
subreddit,nxgConfig):Promise<{changed:boolean;config:ToolboxConfig; }>
Defined in: extension/data/util/wiki/schemas/config/reconcile.ts:135
Reads the legacy toolbox page and folds any 6.x edits into the given NXG
config in memory. The wiki is not written here - callers cache the merged
result and the next save persists it (rewriting the mirror and restoring
equality). Missing pages, tombstones, and read/parse failures are all
no-ops: a flaky mirror must never break config reads.
Parameters¶
subreddit¶
string
The subreddit whose legacy page to check.
nxgConfig¶
The canonical normalized NXG config.
Returns¶
Promise<{ changed: boolean; config: ToolboxConfig; }>
The (possibly merged) config and whether anything was adopted.
Variables¶
LEGACY_OWNED_FIELDS¶
constLEGACY_OWNED_FIELDS: readonly ["removalReasons","modMacros","banMacros"]
Defined in: extension/data/util/wiki/schemas/config/reconcile.ts:33
The config fields 6.x owns and may edit on the legacy page. Everything
else (ver, the NXG metadata keys, stable ids) is NXG-only and never
adopted from the mirror.