fix: always show Verification in sidebar when user has a pending submission
All checks were successful
build-and-release / build (push) Successful in 1m48s
All checks were successful
build-and-release / build (push) Successful in 1m48s
mergeSidebar already restricts the sidebar to 'Verification', 'Settings', 'Help Center' (and conditionally 'My Profile') when a verification is pending. But if the admin's runtime config for this role omits 'Verification', the item was silently absent even after registration — leaving users with no way to track their submission. Fix: after filtering to the restricted set, inject 'Verification' when it is missing and the user has a pending status. This is a safety guarantee: admin config governs approved-role layouts; pending-verification state always wins on the Verification item regardless. Also: - .eslintrc.cjs: add varsIgnorePattern/destructuredArrayIgnorePattern '^_', turn off no-explicit-any (complex runtime config shapes), matching admin config - Prefix unused resolveRuntimeSidebarKeys helper with _ to silence lint Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
7b28301793
commit
84fbfc1d73
2 changed files with 12 additions and 3 deletions
|
|
@ -37,8 +37,8 @@ module.exports = {
|
|||
],
|
||||
rules: {
|
||||
"@typescript-eslint/explicit-function-return-type": "off",
|
||||
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
|
||||
"@typescript-eslint/no-explicit-any": "warn",
|
||||
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_", varsIgnorePattern: "^_", destructuredArrayIgnorePattern: "^_" }],
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"arrow-body-style": ["warn", "as-needed"],
|
||||
curly: ["error", "multi-line"],
|
||||
"no-console": "off",
|
||||
|
|
|
|||
|
|
@ -421,7 +421,7 @@ function normalizeSidebarKey(value: string): string {
|
|||
return key;
|
||||
}
|
||||
|
||||
function resolveRuntimeSidebarKeys(runtimeSidebar: string[]): string[] {
|
||||
function _resolveRuntimeSidebarKeys(runtimeSidebar: string[]): string[] {
|
||||
if (!runtimeSidebar || runtimeSidebar.length === 0) return [];
|
||||
return runtimeSidebar.map(item => normalizeSidebarKey(item));
|
||||
}
|
||||
|
|
@ -599,6 +599,15 @@ function mergeSidebar(
|
|||
: []),
|
||||
]);
|
||||
merged = merged.filter((item) => restricted.has(item.trim().toLowerCase()));
|
||||
|
||||
// Safety guarantee: a user who has a pending verification must always see
|
||||
// "Verification" in their sidebar, even when the admin's runtime config
|
||||
// for this role omits it (e.g. runtime config was set before the
|
||||
// wizard feature was added). Without this, the user has no way to track
|
||||
// the status of their registration submission.
|
||||
if (!merged.some((item) => normalizeSidebarKey(item) === "verification")) {
|
||||
merged = ["Verification", ...merged];
|
||||
}
|
||||
}
|
||||
return merged;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue