Repository navigation
feat(console): the workspace prompt also asks an administrator for a still-unset default currency - #28953
Conversation
…ack/spec/shared plugin-auth's REGION_CURRENCY and currencyForLocale move to packages/spec/src/shared/region-currency.ts, exported from the shared subpath. plugin-auth reads the lookup from there and keeps no copy, so the console can read the same table. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUHdaZrLT9hey9hCyL
…rrency too While localization.currency has no value on any rung, an administrator who may write the namespace is asked once, offered the currency of the browser's region through currencyForLocale from @objectstack/spec/shared. With the timezone still the default as well it is one dialog with both fields and one PUT /api/settings/localization. Decline writes nothing; the prompt's existing per-device record covers both arms. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUHdaZrLT9hey9hCyL
… region-currency exports Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUHdaZrLT9hey9hCyL
… separate format string Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUHdaZrLT9hey9hCyL
📓 Docs Drift Check2 anchor(s) derived from 2 changed package(s); no hand-written page names any of them. What this run could not see
Coarse fallback — 173 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 9c8b308496832cb5dc9787d73cb75e28d338fbe6 && git checkout 9c8b308496832cb5dc9787d73cb75e28d338fbe6
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin ff88105061012c8b14f7ec937d7b3113e404e922 86224bf08620f187d1a9c17af2bee9e4111824dd && git checkout -B drift-repro ff88105061012c8b14f7ec937d7b3113e404e922 && git merge --no-ff 86224bf08620f187d1a9c17af2bee9e4111824dd
node scripts/docs-audit/affected-docs.mjs --json ff88105061012c8b14f7ec937d7b3113e404e922 |
…the currency is unset too The console now opens the one workspace prompt when localization.currency has no value, not only when the timezone is the default. global-setup decided from the timezone alone, so on a backend with a chosen zone and no currency the prompt stayed open over every spec's page. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUHdaZrLT9hey9hCyL
|
domain:ui#1 · zhuangjianguo · session_01QsR2jUJ19MstFvFhjgiYTu 席位核对 · ACCEPT · 2026-11-02T05:31ZHead-sha:
|
Requested by Steedos · project thread
Fixes #28872
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
@objectstack/spec/shared,两边读同一份,控制台不再需要第二份表。es-419这类无国家的语言、容器没设LANG)就什么都不写,所有金额静默显示为裸数字,没人被告知。PUT /api/settings/localization,拒绝什么都不写;没有新设置键、没有服务端 dismissed 标记、没有门禁。回滚即回退本 PR,表搬回 plugin-auth。ui/apps/console/src/pages/settings/workspaceTimezonePromptLogic.ts(findWorkspacePromptOffer与currencyArm的判定);ui/apps/console/src/pages/settings/WorkspaceTimezonePrompt.tsx(两个字段合一个对话框、只写有值的键);packages/spec/src/shared/region-currency.ts(原样搬来的表与查找)。pnpm --dir ui exec vitest run apps/console/src/pages/settings/__tests__/WorkspaceTimezonePrompt.currency-28872.test.tsx,预期全部通过;其中「both unset」组断言只有一个对话框、一次 PUT 同时带timezone与currency。What changes
The table moves to spec (premise checked first).
REGION_CURRENCYandcurrencyForLocalemove unchanged frompackages/plugins/plugin-auth/src/organization-default-currency.tsto a newpackages/spec/src/shared/region-currency.ts, exported from the@objectstack/spec/sharedentry. plugin-auth importscurrencyForLocalefrom there and keeps no copy; neither name was exported from the plugin-auth package entry. The console already imports@objectstack/spec/shared(the prompt logic readsisValueDomainMemberfrom it), so the console reads the same table with no second hand-written copy and no new entry. The module imports nothing.One prompt for both keys.
findWorkspacePromptOffer(replacingfindTimezoneOffer) reads the Settings client once and answers either arm, or both, or nothing:localization.currencyresolves fromsource: 'default'with no value (the key declares no default, so no rung holds one), unlocked, and the browser region's currency is a member of the specifier's value domain. A manifest that declares a default currency has one, so it is not asked about.The browser region's currency is
currencyForLocaleof the FIRST browser language only (browserLanguage): a later preference names a language the person reads, not where they are. A tag with no country region (es-419) offers nothing. Both arms need the namespace'swritePermission, as before, so a non-admin is never asked and never reads the namespace.The dialog shows a
SettingsFieldper arm (the Settings page's own control and error slot). Confirm writes the keys whose field holds a value in onesaveSettingsNamespace('localization', …)call, the Settings page's write path; clearing the currency field in the combined dialog leaves it unset. Decline ("Not now" when the currency is asked; "Keep the default" when only the timezone is) writes nothing. The prompt's existing per-device record (os:workspace-timezone-prompt:ORG:USER) covers both arms. No settings key, server-side dismissed flag or gate is added.Copy. Eight
console.workspaceTimezonePrompt.*strings in all ten built-in locales:currencyTitle,currencyDescription,currencyConfirm,currencySaved,bothTitle,bothConfirm,bothSaved,notNow.currencyDescriptionnames the offer by the currency'sIntl.DisplayNamesname in the UI language and its code (nameandcodeplaceholders), for example 人民币(CNY) in zh and "Chinese Yuan (CNY)" in en. The timezone-only copy is unchanged.Tests
packages/spec/src/shared/region-currency.test.ts(new): the table and lookup pins moved from plugin-auth, plus a pin that the shared entry re-exports the same bindings.packages/plugins/plugin-auth/src/organization-default-currency.test.ts: the two moved describe blocks are removed; the rest is unchanged.organization-created-default-currency.test.ts(the composed path through the real settings service) is unchanged and green.ui/apps/console/src/pages/settings/__tests__/WorkspaceTimezonePrompt.currency-28872.test.tsx(new): the currency arm alone (en and zh copy, pre-fill, one PUT carrying the currency alone, an edited value, decline and no second ask, a refusal in the field's error slot, asked with no browser zone), the combined case (one dialog, both fields, one read, one PUT with both keys, a cleared currency field written as timezone only, decline), and the no-prompt cases (tenant, global and env currency, a manifest default, a non-admin, anes-419browser, nothing to offer means no request).WorkspaceTimezonePrompt.test.tsx: one edit. "no browser zone at all → no prompt and no request" now also stubs the browser language toes-419, because a browser with a currency to offer now reads the settings. Every other timezone pin is untouched.Acceptance notes
es-419) is not asked, by the card's "offering the browser region's currency"; no guess is made from later preferences.localization.currency; this PR writes the key through the Settings page's path and does not change the renderer.Verification
Branch base
97680bbb; readings on head93694e2eunless named.origin/mainhas moved 7 commits since, none touching a file this diff changes.Tests
pnpm --filter @objectstack/spec exec vitest run src/shared/region-currency.test.ts src/shared/value-domain.test.ts: 2 files, 41/41 passed (at2c068e8f;packages/spec/srcunchanged since).pnpm --filter @objectstack/plugin-auth exec vitest run src/organization-default-currency.test.ts src/organization-created-default-currency.test.ts: 2 files, 26/26 passed (at2c068e8f; plugin-auth unchanged since).pnpm --dir ui exec vitest runon the threeWorkspaceTimezonePrompt*files pluspackages/i18n/: 97 files, 1477 passed, 13 skipped, 0 failed.pnpm --dir ui exec vitest run scripts/: 169 files passed, 2 skipped; 4900 tests passed.scripts/ablation-replace.mjsreplacedif (currency) offer.currency = currency;infindWorkspacePromptOffer; the currency test file went 11 failed / 9 passed, and the restore leg read blob == HEAD with an emptygit diff HEAD.Type-check, lint, generated artifacts
turbo run type-check --filter=@object-ui/console --filter=@object-ui/i18n: 72/72 tasks;turbo run typecheck --filter=@objectstack/spec --filter=@objectstack/plugin-auth: 33/33 tasks.ui/).pnpm --filter @objectstack/spec check:generated: two artifacts stale after the export (api-surface/shared.json,export-origins/shared.json), regenerated withgen:api-surfaceandgen:export-origins, then all gates up to date.Derived gates
node scripts/pm/dispatch-gates.mjs --ran: 87 derived families accounted for, 86 run, 1 NOT MEASURED.pnpm check:dual-build-cjs-loadsanswered PREREQUISITE NOT MET (exit 3: it reads every package'sdist/, and this worktree did not run a fullpnpm build); CI's Lint and Repo Gates runs it.check-plugin-teardown-shape --self-testfirst exited 3 on the shallow clone's missing fixture commit, then 0 after fetching that commit. The PR-body gates (check-changeset-no-major,check-closing-keyword-parity,check-partof-closing-keyword,check-adr-0087-registration,check-empty-changeset) ran on this body: exit 0.pnpm check:new-line-citationsunderui/: 0 new citations.🤖 Generated with Claude Code
https://claude.ai/code/session_01QsR2jUHdaZrLT9hey9hCyL
Generated by Claude Code