diff options
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/group-settings.js')
| -rw-r--r-- | packages/meshbay-hub/src/meshbay_hub/static/group-settings.js | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/group-settings.js b/packages/meshbay-hub/src/meshbay_hub/static/group-settings.js index 4ae832f..22532fa 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/group-settings.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/group-settings.js @@ -1,5 +1,5 @@ import { - html, useState, useEffect, useCallback, useMemo, + html, useState, useEffect, useCallback, useMemo, useRef, } from './vendor/htm-preact.js'; import { t, getLocale, LOCALES } from './i18n.js'; import { Icon } from './icon.js'; @@ -311,6 +311,24 @@ function GroupSettingsPanel({ groupId, group, token, transportRef, gekRef, } }, [transportRef, onTmdbConfig, tmdbTokenDraft, tmdbConfig, tmdbLanguage]); + // A node that has never had a language explicitly set would otherwise + // query TMDB with none at all — which TMDB itself resolves to English, + // regardless of who the operator is — even though this form already + // *suggests* their own UI language as the value. Applied once, + // automatically, the first time the operator (the only one who can sign + // this) is actually connected to see it: a real default tied to whoever + // runs this particular node, never a single hardcoded language for every + // node. `tmdbConfig.language` being set at all — from this or from an + // explicit save — is what stops it from ever firing again, so "unless + // manually changed" holds regardless of which of the two set it first. + const autoLanguageSetRef = useRef(false); + useEffect(() => { + if (!isNodeAdmin || !connected || !tmdbConfig || tmdbConfig.language) return; + if (autoLanguageSetRef.current) return; + autoLanguageSetRef.current = true; + saveTmdbConfig(tmdbEnabled); + }, [isNodeAdmin, connected, tmdbConfig, tmdbEnabled, saveTmdbConfig]); + // Every folder anywhere in the group's shared index, deepest included — // `entries[].path` is each file's containing directory (files-app.js's own // convention), so every ancestor prefix of it is a real folder, and |