mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2026-09-03 05:10:16 +03:00
fix(editor): respect no-login settings visibility in config navigation (#6807)
# Description of Changes This change fixes the editor configuration navigation for issue #6800 by passing the `showSettingsWhenNoLogin` configuration flag through all config navigation section hooks. - Added `config?.showSettingsWhenNoLogin ?? true` when building the app config modal navigation. - Extended shared, desktop, and proprietary `useConfigNavSections` signatures to accept the `showSettingsWhenNoLogin` flag. - Forwarded the flag from desktop and proprietary config navigation wrappers into the shared navigation logic. - Updated proprietary admin section visibility so read-only admin previews are only shown when login is disabled and `system.showSettingsWhenNoLogin` allows it. The change was made to ensure deployments with login disabled can still control whether settings/admin configuration entries are visible, matching the existing `showSettingsWhenNoLogin` behavior. Closes #6800 <img width="1920" height="1032" alt="image" src="https://github.com/user-attachments/assets/193f083b-3c87-4466-8e91-81a13a27cec3" /> --- ## Checklist ### General - [x] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [x] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) (if applicable) - [x] I have performed a self-review of my own code - [x] My changes generate no new warnings ### Documentation - [x] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [x] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### Translations (if applicable) - [ ] I ran [`scripts/counter_translation.py`](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/docs/counter_translation.md) ### UI Changes (if applicable) - [x] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [x] I have run `task check` to verify linters, typechecks, and tests pass - [x] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#7-testing) for more details.
This commit is contained in:
@@ -216,6 +216,7 @@ const AppConfigModalInner: React.FC<AppConfigModalProps> = ({
|
||||
runningEE,
|
||||
loginEnabled,
|
||||
handleCloseSync,
|
||||
config?.showSettingsWhenNoLogin ?? true,
|
||||
);
|
||||
const configNavSections = useMemo(
|
||||
() =>
|
||||
|
||||
@@ -32,6 +32,7 @@ export const useConfigNavSections = (
|
||||
_runningEE: boolean = false,
|
||||
_loginEnabled: boolean = false,
|
||||
onRequestClose: () => void = () => {},
|
||||
_showSettingsWhenNoLogin: boolean = true,
|
||||
): ConfigNavSection[] => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ export const useConfigNavSections = (
|
||||
runningEE: boolean = false,
|
||||
loginEnabled: boolean = false,
|
||||
onRequestClose: () => void = () => {},
|
||||
showSettingsWhenNoLogin: boolean = true,
|
||||
): ConfigNavSection[] => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -53,6 +54,7 @@ export const useConfigNavSections = (
|
||||
runningEE,
|
||||
loginEnabled,
|
||||
onRequestClose,
|
||||
showSettingsWhenNoLogin,
|
||||
);
|
||||
|
||||
const connectionModeSection: ConfigNavSection = {
|
||||
|
||||
@@ -32,6 +32,7 @@ export const useConfigNavSections = (
|
||||
runningEE: boolean = false,
|
||||
loginEnabled: boolean = false,
|
||||
onRequestClose: () => void = () => {},
|
||||
showSettingsWhenNoLogin: boolean = true,
|
||||
): ConfigNavSection[] => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -41,6 +42,7 @@ export const useConfigNavSections = (
|
||||
runningEE,
|
||||
loginEnabled,
|
||||
onRequestClose,
|
||||
showSettingsWhenNoLogin,
|
||||
);
|
||||
|
||||
// Add account management under Preferences
|
||||
@@ -64,8 +66,9 @@ export const useConfigNavSections = (
|
||||
}
|
||||
}
|
||||
|
||||
// Add Admin sections if user is admin OR if login is disabled (but mark as disabled)
|
||||
if (isAdmin || !loginEnabled) {
|
||||
// Add Admin sections for admins. When login is disabled, keep the historical
|
||||
// read-only admin preview only if system.showSettingsWhenNoLogin allows it.
|
||||
if (isAdmin || (!loginEnabled && showSettingsWhenNoLogin)) {
|
||||
const requiresLogin = !loginEnabled;
|
||||
const enableLoginTooltip = t(
|
||||
"settings.tooltips.enableLoginFirst",
|
||||
|
||||
Reference in New Issue
Block a user