Skip to content

Commit dc4a2cd

Browse files
fix(console): a line under the organization name while it is the platform name (#39043, half B) (#39301)
Part of #39043 Clause-②: yes (widening) Metadata-protocol: none ## 维护者速读 - 管理员打开「组织基本信息」表单时:组织还叫系统默认名,名称栏仍是空的,但栏下多一行字说明现在用的是默认名、请填自己的名字;已有自己的名字时照旧预填、不显示这行。 - 属于首次使用清单的体验收尾,按你对第二问「B 留空加说明」的裁决实现;开发模式自动写入时区货币的另一半走单独的 PR。 - 出错最多是这行字该出现时没出现或不该出现时出现,保存规则没动,撤回这个改动即可恢复原样。 - 无 ## What changes This PR does not close the card: half A is still open, and the seat closes the card by hand once both halves have merged. Half B of the ruling on the card above (ruling comment 7359875657, "Ruled terms, B (organization name)"). Half A, retiring the plugin-auth development seeds, rides its own PR (#39302) on branch `claude/issue-39043-dev-seeds-retired`; this PR touches nothing under `packages/plugins/**` or `docs/qa/**`. - `ui/apps/console/src/pages/settings/FirstRunChecklist.tsx`: while the organization's stored name is the platform's (`isOrganizationNamed` false and the name non-empty), the basics form passes one line to the name field through `SettingsField`'s existing `note` prop. The line names the current name and asks for the organization's own. With a name of its own the field is prefilled as before and no line is drawn. It is a line under the field, wired into the input's `aria-describedby` by the field itself, not a placeholder. The shared settings field component is unchanged, and so are the Save rule and its sentence. - `ui/packages/i18n/src/locales/*.ts`: one new key, `console.firstRunChecklist.organizationBasics.defaultNameNote` (interpolates `name`), in the 11 locale packs that carry the `firstRunChecklist` block: ar, de, en, es, fr, ja, ko, pt-BR, ru, zh-Hans, zh-Hant. The other three files in that directory (`index.ts`, `registry.ts`, `rtl.ts`) are not packs. zh-Hant is regenerated from zh-Hans with `gen:zh-hant`, not hand-written. The zh-Hans text is the line the maintainer approved on the decision card, with the current name interpolated. - `Clause-②: yes (widening)`: the claim carried `no`, on the condition that this be measured. `@object-ui/i18n` exports `TranslationKeys = typeof en`. After a build, `ui/packages/i18n/dist/locales/en.d.ts` carries `readonly defaultNameNote: ...` in that type, so the published type surface gains one key. That makes it a widening. Metadata protocol: none. Level: patch. - Changeset: `.changeset/39043-org-name-default-line.md` (`@object-ui/console`, `@object-ui/i18n`, patch). Read first, in order of risk: 1. `FirstRunChecklist.tsx`, the `defaultNameNote` hunk: the condition that decides when the line shows. 2. `__tests__/FirstRunChecklist.test.tsx`: the new top-level describe pins both directions. 3. `zh-Hans.ts` / `en.ts`: the wording of the line. Round 2 (head eea94d3) rewords es/fr/pt-BR to "the name of your organization" (the earlier wording read as "proper noun") and points the code comment at `onSave` below. ## Tests The new pin is a top-level `describe` in the existing harness `ui/apps/console/src/pages/settings/__tests__/FirstRunChecklist.test.tsx`. AGENTS.md puts a new pin for a component that already has a shared harness file into that file. It covers four cases: - platform name: the field is empty, the line names 「Default Organization」, the placeholder does not, and the input's `aria-describedby` includes the line; - real name: the field is prefilled with 「Acme」 and no line is drawn; - Save rule unchanged: typing the platform name is refused with the same sentence, the line stays beside the refusal, and nothing is written; - zh: the line reads in Chinese and still names the current name. <details><summary>Readings</summary> - `pnpm --dir ui exec vitest run --maxWorkers=2 apps/console/src/pages/settings/__tests__/FirstRunChecklist.test.tsx` → `Tests 99 passed (99)` - `pnpm --dir ui exec vitest run --maxWorkers=2 packages/i18n/ apps/console/src/pages/settings/` → `Test Files 156 passed (156)`, `Tests 2388 passed | 13 skipped (2401)` - Ablation 1 (`node scripts/ablation-replace.mjs`, deletes the `note={defaultNameNote}` prop): 3 of the 4 new cases red (platform name, Save rule, zh); the real-name case stays green, as it should. Restored: blob equals HEAD and `git diff HEAD` is empty. - Ablation 2 (removes the `!basics.named &&` guard so the line is always drawn): the real-name case is red, the other 3 green. Restored the same way. - `pnpm --filter @object-ui/i18n type-check` → exit 0 - `pnpm --dir ui exec vitest run scripts/` → `Tests 5161 passed | 2 skipped` - `pnpm check:new-line-citations` (under `ui/`) → `0 new citation(s)` </details> ## Acceptance notes - Screenshot of the form both ways: NOT MEASURED. The console was not booted; the two-way render is pinned in jsdom by the tests above. - Console `tsc --noEmit`: NOT MEASURED locally, because the `@object-ui/*` closure is not built in this container (every error is a missing-module or implicit-any error caused by that). CI's `Type Check UI` lane owns it. - `pnpm check:query-options-erasure`: NOT MEASURED locally (killed by a 250 s timeout on a shared box); CI runs it. - The line shows when the stored name is the platform name. An organization whose stored name is empty gets no line, because there is no current name to show; the field is empty and Save asks for a name as before. ## Verification Two-minute check: `pnpm --dir ui exec vitest run apps/console/src/pages/settings/__tests__/FirstRunChecklist.test.tsx -t "the name field while"` → 4 passed. In a running console on a fresh database: Setup, 系统概览, 组织基本信息, 设置. The name field is empty and the line under it reads 「现在用的是系统默认名“Default Organization”,请填你们自己的名字。」. --- _Generated by [Claude Code](https://claude.ai/code/session_01Utp6CbFgiyGToVRBFwedwF)_ <!-- signed: repo:objectstack@os-bill · os-bill · session_01Utp6CbFgiyGToVRBFwedwF --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 211c1aa commit dc4a2cd

14 files changed

Lines changed: 94 additions & 0 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@object-ui/console': patch
3+
'@object-ui/i18n': patch
4+
---
5+
6+
fix(console): the first-run basics form says why the organization name is empty while the organization still carries the platform's default name
7+
8+
Clause-②: yes (widening)
9+
Metadata-protocol: none
10+
11+
In the administrator's first-run checklist, the 「Organization basics」 form leaves the name field empty while the organization still has the name the platform created it with (「Default Organization」), because that name does not count as the organization's own. Until now nothing said so. The form now draws one line under the field that names the current name and asks for the organization's own; once the organization has a name of its own the field is prefilled with it and the line is not drawn. It is a line under the field, not a placeholder inside it, and it is read with the field by a screen reader. The Save rule is unchanged: the platform's name is still refused with the same sentence, and the row is done only with a real name.
12+
13+
`@object-ui/i18n` adds `console.firstRunChecklist.organizationBasics.defaultNameNote` (interpolating `name`) in all eleven locale packs, so the exported `TranslationKeys` type gains that key.

‎ui/apps/console/src/pages/settings/FirstRunChecklist.tsx‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,17 @@ function OrganizationBasicsEditor({
276276
label: t('console.firstRunChecklist.organizationBasics.name'),
277277
maxLength: 120,
278278
};
279+
// While the organization still carries the name the platform created it
280+
// with, the field starts empty and one line under it names that name and
281+
// asks for the organization's own (ruling on objectstack#39043, B): a line
282+
// under the field, never a placeholder inside it, so the platform's name
283+
// never reads as a value already there. A name of its own prefills the field
284+
// and draws no line. The Save rule below (`onSave`) is unchanged.
285+
const currentName = data.organizationName.trim();
286+
const defaultNameNote =
287+
!basics.named && currentName !== ''
288+
? t('console.firstRunChecklist.organizationBasics.defaultNameNote', { name: currentName })
289+
: undefined;
279290

280291
const onSave = async () => {
281292
if (saving) return;
@@ -368,6 +379,7 @@ function OrganizationBasicsEditor({
368379
}}
369380
saving={saving}
370381
error={fieldErrors[NAME_FIELD]}
382+
note={defaultNameNote}
371383
/>
372384
{basics.fields.map((field) => (
373385
<SettingsField

‎ui/apps/console/src/pages/settings/__tests__/FirstRunChecklist.test.tsx‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,53 @@ describe('the basics: one form, pre-filled from the browser, written by one Save
681681
});
682682
});
683683

684+
describe('the name field while the organization carries the platform name: empty, with one line under it (objectstack#39043 B)', () => {
685+
/** The basics form's name input, and the line the form draws under it (or null). */
686+
async function openNameField(language?: 'en' | 'zh') {
687+
renderChecklist(ADMIN, language);
688+
fireEvent.click(await screen.findByTestId('first-run-checklist-set-organization_basics'));
689+
const editor = screen.getByTestId('first-run-checklist-editor-organization_basics');
690+
const input = within(editor).getAllByRole('textbox')[0] as HTMLInputElement;
691+
return { editor, input, note: () => within(editor).queryByTestId('settings-field-note') };
692+
}
693+
694+
it('the platform name: the field starts empty and one line under it names the current name', async () => {
695+
const { input, note } = await openNameField();
696+
expect(input.value).toBe('');
697+
// A line under the field, not a placeholder inside it.
698+
expect(input.getAttribute('placeholder') ?? '').not.toContain('Default Organization');
699+
expect(note()?.textContent).toContain('Default Organization');
700+
// The line describes the input for a screen reader too.
701+
expect(input.getAttribute('aria-describedby')).toContain(note()?.id);
702+
});
703+
704+
it('a name of its own: the field is prefilled and no line is drawn', async () => {
705+
AUTH.activeOrganization = { id: 'org_1', name: 'Acme' };
706+
const { input, note } = await openNameField();
707+
expect(input.value).toBe('Acme');
708+
expect(note()).toBeNull();
709+
});
710+
711+
it('the Save rule is unchanged: the platform name is still refused, with the same sentence, and nothing is written', async () => {
712+
const { input, note } = await openNameField();
713+
fireEvent.change(input, { target: { value: 'Default Organization' } });
714+
fireEvent.click(screen.getByTestId('first-run-checklist-save-organization_basics'));
715+
expect(await screen.findByText('Enter a name for your organization.')).toBeTruthy();
716+
// The refusal does not take the line's place.
717+
expect(note()?.textContent).toContain('Default Organization');
718+
await settle();
719+
expect(puts()).toHaveLength(0);
720+
expect(AUTH.updateOrganization).not.toHaveBeenCalled();
721+
});
722+
723+
it('zh: the line reads in the reader language and still names the current name', async () => {
724+
const { note } = await openNameField('zh');
725+
const text = note()?.textContent ?? '';
726+
expect(text).toContain('Default Organization');
727+
expect(text).toMatch(/[一-鿿]/);
728+
});
729+
});
730+
684731
describe('the sidebar pill: 「Get started n/m」 for an administrator, in every app (objectstack#36739)', () => {
685732
it('an administrator sees it with the rows done of the rows drawn, and a press opens the list in place', async () => {
686733
renderPill(ADMIN);

‎ui/packages/i18n/src/locales/ar.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2860,6 +2860,8 @@ const ar = {
28602860
todo: "الاسم واللغة والبلد الافتراضيان والمنطقة الزمنية والعملة، تُحفظ معًا.",
28612861
name: "اسم المؤسسة",
28622862
nameRequired: "أدخل اسمًا لمؤسستك.",
2863+
// objectstack#39043: the line under the name while the organization carries the platform's name.
2864+
defaultNameNote: 'لا تزال المؤسسة تحمل الاسم الافتراضي للمنصة "{{name}}". أدخل الاسم الخاص بمؤسستك.',
28632865
prefilled: "القيم التي لم تُعيَّن بعد مقترحة من متصفحك. لن يُحفظ شيء حتى تضغط حفظ.",
28642866
save: "حفظ",
28652867
saved: "تم حفظ البيانات الأساسية للمؤسسة",

‎ui/packages/i18n/src/locales/de.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2580,6 +2580,8 @@ const de = {
25802580
todo: "Name, Standardsprache und -land, Zeitzone und Währung, in einem Schritt gespeichert.",
25812581
name: "Name der Organisation",
25822582
nameRequired: "Geben Sie einen Namen für Ihre Organisation ein.",
2583+
// objectstack#39043: the line under the name while the organization carries the platform's name.
2584+
defaultNameNote: "Derzeit trägt die Organisation den Standardnamen der Plattform „{{name}}“. Geben Sie den eigenen Namen Ihrer Organisation ein.",
25832585
prefilled: "Noch nicht festgelegte Werte sind aus Ihrem Browser vorgeschlagen. Gespeichert wird erst, wenn Sie auf Speichern klicken.",
25842586
save: "Speichern",
25852587
saved: "Grunddaten der Organisation gespeichert",

‎ui/packages/i18n/src/locales/en.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2934,6 +2934,8 @@ const en = {
29342934
todo: 'Name, default language and country, time zone and currency, saved in one go.',
29352935
name: 'Organization name',
29362936
nameRequired: 'Enter a name for your organization.',
2937+
// objectstack#39043: the line under the name while the organization carries the platform's name.
2938+
defaultNameNote: "The organization still has the platform's default name “{{name}}”. Enter your organization's own name.",
29372939
prefilled: 'Values not set yet are suggested from your browser. Nothing is saved until you press Save.',
29382940
save: 'Save',
29392941
saved: 'Organization basics saved',

‎ui/packages/i18n/src/locales/es.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2652,6 +2652,8 @@ const es = {
26522652
todo: "Nombre, idioma y país predeterminados, zona horaria y moneda, guardados de una vez.",
26532653
name: "Nombre de la organización",
26542654
nameRequired: "Introduzca un nombre para su organización.",
2655+
// objectstack#39043: the line under the name while the organization carries the platform's name.
2656+
defaultNameNote: "La organización aún tiene el nombre predeterminado de la plataforma «{{name}}». Introduzca el nombre de su organización.",
26552657
prefilled: "Los valores aún sin configurar se sugieren a partir de su navegador. No se guarda nada hasta que pulse Guardar.",
26562658
save: "Guardar",
26572659
saved: "Datos básicos de la organización guardados",

‎ui/packages/i18n/src/locales/fr.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2648,6 +2648,8 @@ const fr = {
26482648
todo: "Nom, langue et pays par défaut, fuseau horaire et devise, enregistrés en une fois.",
26492649
name: "Nom de l’organisation",
26502650
nameRequired: "Saisissez un nom pour votre organisation.",
2651+
// objectstack#39043: the line under the name while the organization carries the platform's name.
2652+
defaultNameNote: "L’organisation porte encore le nom par défaut de la plateforme « {{name}} ». Saisissez le nom de votre organisation.",
26512653
prefilled: "Les valeurs non encore définies sont suggérées d’après votre navigateur. Rien n’est enregistré avant que vous cliquiez sur Enregistrer.",
26522654
save: "Enregistrer",
26532655
saved: "Informations de base de l’organisation enregistrées",

‎ui/packages/i18n/src/locales/ja.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2582,6 +2582,8 @@ const ja = {
25822582
todo: "組織名、既定の言語と国/地域、タイムゾーン、通貨をまとめて保存します。",
25832583
name: "組織名",
25842584
nameRequired: "組織名を入力してください。",
2585+
// objectstack#39043: the line under the name while the organization carries the platform's name.
2586+
defaultNameNote: "現在はシステムの既定名「{{name}}」が使われています。組織独自の名前を入力してください。",
25852587
prefilled: "未設定の項目はブラウザーの設定から提案しています。「保存」を押すまで何も保存されません。",
25862588
save: "保存",
25872589
saved: "組織の基本情報を保存しました",

‎ui/packages/i18n/src/locales/ko.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2580,6 +2580,8 @@ const ko = {
25802580
todo: "조직 이름, 기본 언어와 국가, 시간대, 통화를 한 번에 저장합니다.",
25812581
name: "조직 이름",
25822582
nameRequired: "조직 이름을 입력하세요.",
2583+
// objectstack#39043: the line under the name while the organization carries the platform's name.
2584+
defaultNameNote: '현재 시스템 기본 이름 "{{name}}"이(가) 사용되고 있습니다. 조직 고유의 이름을 입력하세요.',
25832585
prefilled: "아직 설정하지 않은 항목은 브라우저 설정을 바탕으로 제안했습니다. 저장을 누르기 전에는 아무것도 저장되지 않습니다.",
25842586
save: "저장",
25852587
saved: "조직 기본 정보를 저장했습니다",

0 commit comments

Comments
 (0)