fix(atlas): keep auth.service at its size, finish the last ratchets

- The public config's feature switches, the Atlas comparison among them,
  move into a helper, so auth.service shrinks instead of growing past its
  size baseline (lowered to the new length).
- French "continents" in the many form is the French word too.
- useAtlasCountryActions no longer imports the API: off the offline list.
- The eslint baseline follows two lower counts.
This commit is contained in:
Maurice
2026-11-29 00:21:10 +01:00
parent 06b08cd9d5
commit 6068c34c35
6 changed files with 25 additions and 21 deletions
+2 -2
View File
@@ -11,8 +11,8 @@
"react-hooks/refs": 522,
"react-hooks/set-state-in-effect": 188,
"@typescript-eslint/no-floating-promises": 162,
"react-hooks/exhaustive-deps": 113,
"@typescript-eslint/no-unused-vars": 101,
"react-hooks/exhaustive-deps": 112,
"@typescript-eslint/no-unused-vars": 100,
"react-hooks/immutability": 26,
"max-lines-per-function": 126,
"react-hooks/static-components": 38,
-1
View File
@@ -129,7 +129,6 @@
"src/pages/OAuthAuthorizePage.tsx",
"src/pages/admin/useAdmin.ts",
"src/pages/admin/useNotificationDefaults.ts",
"src/pages/atlas/useAtlasCountryActions.ts",
"src/pages/collections/useCollections.ts",
"src/pages/dashboard/useDashboard.ts",
"src/pages/dashboard/useTripSearch.ts",
+1 -1
View File
@@ -6,7 +6,7 @@
"src/db/repositories/Trips.repository.ts": 1120,
"src/db/repositories/Users.repository.ts": 1421,
"src/nest/atlas/atlas.service.ts": 1166,
"src/nest/auth/auth.service.ts": 1126,
"src/nest/auth/auth.service.ts": 1115,
"src/nest/budget/budget.service.ts": 1607,
"src/nest/collections/collections.service.ts": 1414,
"src/nest/doc-sync/doc-sync.service.ts": 1060,
+19
View File
@@ -162,3 +162,22 @@ export function appSettingsAudit(
);
return { summary, debugDetails };
}
/**
* The feature switches of the public app config, read from the instance settings
* in the order the response has always listed them.
*/
export function publicFeatureFlags(settings: Map<string, string>) {
return {
places_photos_enabled: settings.get('places_photos_enabled') !== 'false',
places_autocomplete_enabled: settings.get('places_autocomplete_enabled') !== 'false',
places_details_enabled: settings.get('places_details_enabled') !== 'false',
places_enrich_enabled: settings.get('places_enrich_enabled') !== 'false',
// Fail-closed, and deliberately on this unauthenticated endpoint: whether an
// instance records what its users search for is something a visitor is
// entitled to know before logging in, not a detail to keep behind the door.
place_shadow_enabled: settings.get('place_shadow_enabled') === 'true',
// The Atlas comparison of travellers; on until an admin stores 'false'.
atlas_compare_enabled: settings.get('atlas_compare_enabled') !== 'false',
};
}
+2 -16
View File
@@ -70,6 +70,7 @@ import {
parseBackupCodeHashes,
stripUserForClient,
appSettingsAudit,
publicFeatureFlags,
} from './auth.helpers';
import {
ADMIN_FORM_SETTING_KEYS,
@@ -330,16 +331,6 @@ export class AuthService {
const hasWebhookEnabled = activeChannels.includes('webhook');
const hasPushEnabled = activeChannels.includes(WEB_PUSH_CHANNEL_ID);
const tripRemindersEnabled = tripReminderSetting !== 'false';
const placesPhotosEnabled = settings.get('places_photos_enabled') !== 'false';
const placesAutocompleteEnabled = settings.get('places_autocomplete_enabled') !== 'false';
const placesDetailsEnabled = settings.get('places_details_enabled') !== 'false';
const placesEnrichEnabled = settings.get('places_enrich_enabled') !== 'false';
// Fail-closed, and deliberately on this unauthenticated endpoint: whether an
// instance records what its users search for is something a visitor is
// entitled to know before logging in, not a detail to keep behind the door.
const placeShadowEnabled = settings.get('place_shadow_enabled') === 'true';
// The Atlas comparison of travellers; on until an admin stores 'false'.
const atlasCompareEnabled = settings.get('atlas_compare_enabled') !== 'false';
const setupComplete = userCount > 0 && (await this.usersRepo.findAdminNeedingPasswordChange()) === null;
return {
@@ -389,12 +380,7 @@ export class AuthService {
notification_channels: activeChannels,
available_channels: { email: hasSmtpHost, webhook: hasWebhookEnabled, push: hasPushEnabled, inapp: true },
trip_reminders_enabled: tripRemindersEnabled,
places_photos_enabled: placesPhotosEnabled,
places_autocomplete_enabled: placesAutocompleteEnabled,
places_details_enabled: placesDetailsEnabled,
places_enrich_enabled: placesEnrichEnabled,
place_shadow_enabled: placeShadowEnabled,
atlas_compare_enabled: atlasCompareEnabled,
...publicFeatureFlags(settings),
permissions: authenticatedUser ? (await this.permissions.getAllPermissions()) : undefined,
// Case-sensitive on purpose (legacy parity).
dev_mode: readEnv().app.nodeEnv === 'development',
+1 -1
View File
@@ -119,7 +119,7 @@ const atlas: TranslationStrings = {
'atlas.badge.continentsDesc': 'Visitez les six continents habités.',
'atlas.badge.continentsN': '{count} continents', // same-as-en
'atlas.badge.continentsN.one': '{count} continent', // same-as-en
'atlas.badge.continentsN.many': '{count} continents',
'atlas.badge.continentsN.many': '{count} continents', // same-as-en
'atlas.badge.continentsNDesc': 'Posez le pied sur {count} continents.',
'atlas.badge.continentsNDesc.one': 'Posez le pied sur {count} continent.',
'atlas.badge.continentsNDesc.many': 'Posez le pied sur {count} continents.',