Skip to content

Commit 2f8e8ba

Browse files
fix(record-page): no empty Activity stream tab when an object switches off all three of its sources (#36783)
<!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ87Aq2qvBEo7uvnH8jmQeYKf)_ Fixes #36693 Clause-②: no Metadata-protocol: none ## 维护者速读 - 记录详情页:对象把讨论、活动、字段变更三个来源都关掉后,「动态」页签不再出现;任一来源开着,页签照旧。 - 落实你对 36627 的裁决(选 A′):「动态」页签跟随对象的能力开关,和「附件」跟随文件开关一样;「审批」不变。 - 只影响默认生成的记录页,手工设计的页面照作者摆放;出错最多是页签多一个或少一个,数据不受影响,可直接撤回。 - 无。 ## What changes The default record page's 动态 (Activity stream) tab merges three sources, each switched by the object: the discussion (`enable.feeds`, opt-out), activities (`enable.activities`, opt-out) and field changes (`enable.trackHistory`, opt-in). An object with all three off still drew the tab, empty, on every record page. Ruling A′ on #36627 (the maintainer, project chat, 2026-11-23T11:57Z: 「36627 选 A′」): the stream tab follows the object's capability switches, the way Attachments follows `enable.files`. - **`@object-ui/plugin-detail`** — `buildDefaultPageSchema` / `buildDefaultTabs` (via `synthTabs`) emit no stream tab and no `record:activity` node when `feeds` and `activities` are both `false` and `trackHistory` is not `true` (new internal `streamHasSource`). The wide layout's 动态 column comes off the same page, so it goes too (`buildDefaultPageColumns` already handles an empty stream). An authored `discussion` slot still draws whatever the switches say; an authored (assigned) page is untouched. A `relatedLists` entry `'sys_activity'` does not bring the tab back: `arrangeDeclaredTabs` only places tabs that were built. A field's own `trackHistory` / `fieldHistory` are not read: they decide whether a change shows its old → new values, not whether changes show. - Docs: `content/docs/ui/pages.mdx` (the synthesized default) and `ui/packages/plugin-detail/README.md` say when 动态 is left out. - Approvals is unchanged (CONTROL): drawn only when the record has approval requests. Read first (by risk): 1. `ui/packages/plugin-detail/src/synth/buildDefaultPageSchema.ts` — `streamHasSource` and its two call sites (`synthTabs`, `buildDefaultPageSchema`'s `timeline`). 2. `ui/packages/plugin-detail/src/synth/__tests__/buildDefaultPageSchema.test.ts` — the new describe block. ## Tests Head `aecc0379`. - `pnpm --dir ui exec vitest run packages/plugin-detail/src/synth/ packages/plugin-detail/src/__tests__/RecordPageColumns packages/plugin-detail/src/__tests__/RecordTabRow packages/plugin-detail/src/__tests__/RecordTimeline` → `Test Files 27 passed (27)`, `Tests 389 passed (389)`. New: `activity stream tab follows its sources (objectstack#36693)` — all off → `['details']` and no `record:activity`; each one source on → `['details','timeline']` (one key per control); a `'sys_activity'` entry does not revive it (control: with a source on it places the tab); an authored discussion slot still draws; Approvals CONTROL; a details slot keeps the gate. - `pnpm --filter @object-ui/plugin-detail type-check` exit 0. - Head `7f15e128` (lint half dropped, comment-only change in the source): `pnpm --dir ui exec vitest run packages/plugin-detail/src/synth/` → `Test Files 17 passed (17)`, `Tests 237 passed (237)`; changeset, doc-authoring, doc-anchors, issue-citations, nul-bytes and affected-docs gates exit 0. ## Acceptance notes - The card's lint warning for a `'sys_activity'` entry on such an object: dropped — new lint warning; new gates default no. - The console's own gate for field changes in the stream (`historyEnabled`) also needs `sys_audit_log` registered. The synthesizer reads the object alone, so an object with `trackHistory: true` on a host without the audit object still gets the tab (as today). Not changed here: the card names the object's switches. - The Studio "new record page" seed also starts from `buildDefaultPageSchema`, so for an all-off object it no longer seeds a `record:activity` block (it would have drawn nothing). An author can still place one. ## Verification <details><summary>Local gate subset (29 commands from <code>dispatch-gates.mjs --commands</code>, all exit 0 at <code>aecc0379</code>)</summary> The doc, changeset, citation, published-file, test-input and type-check-ratchet families from the derived list: `check-adr-0087-registration`, `check-changeset-no-major`, `check-empty-changeset`, `check-closing-keyword-parity`, `check-docs-section-name`, `check-issue-citations`, `check-doc-route-spelling --advisory`, `docs-audit/check-affected-docs`, `docs-audit/check-drift-comment`, lint `check:doc-formula-expressions` and `check:doc-security-posture`, `check:doc-authoring`, `check:doc-anchors`, `check:doc-frontmatter`, `check:docs-single-h1`, `check:docs-spec-enumerations`, `check:issue-citations`, `check:nul-bytes`, `check:published-readme-links`, `check:published-files`, `check:cross-package-test-inputs`, `check:test-source-alias`, `check:keyed-text-bounds`, `check:role-word`, `check:corpus-claim-drift`, `check:closed-ceremony-text`, `check:type-check-coverage`, `check:type-check-debt`, `check:changeset-gate-self-tests`. The rest of the derived list and the full farm run in CI. </details> Browser check (showcase app, zh-CN, 1440 × 900 and 900 × 900, `showcase_contact` given `enable: { feeds: false, activities: false }` locally for the run, not committed; frames are attached in the project thread, since GitHub image upload is browser-only): 1. Before (the gate forced open, same record): the right column's tabs read 发票 · 动态, and 动态 has nothing to draw. 2. After, wide: the right column reads 发票 only; no 动态 anywhere on the page (`document.body.innerText` has no 动态). 3. After, 900 px: the same, 发票 only. 4. Control, `showcase_account` (sources on by default, `trackHistory: true`): 详情 · 联系人 · two lookup lists · 动态, unchanged. The showcase's `showcase_project` has an authored record page, so it keeps what its author placed; that is the card's "an assigned page keeps drawing what its author placed". Two-minute check: give `showcase_contact` `enable: { feeds: false, activities: false }`, open any contact: the right column shows 发票 and no 动态. Remove `feeds: false` and 动态 is back at the end. --- _Generated by [Claude Code](https://claude.ai/code/session_01JQwxbZqzpvmAjPGjiWCwwS)_ <!-- signed: repo:objectstack#1 · os-warren · session_01JQwxbZqzpvmAjPGjiWCwwS --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent e94eacd commit 2f8e8ba

5 files changed

Lines changed: 113 additions & 10 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@object-ui/plugin-detail': patch
3+
---
4+
5+
fix(record-page): the default record page draws no empty 动态 (Activity stream) tab when the object switches off all three of its sources
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The activity stream merges three sources, each switched by the object: the discussion (`enable.feeds`), activities (`enable.activities`) and field changes (`enable.trackHistory`). An object that turned off all three still showed a 动态 tab on every record page, with nothing in it. The synthesized default page now leaves that tab out, the same way the Attachments tab follows `enable.files`: with `enable: { feeds: false, activities: false }` and `trackHistory` not `true`, `buildDefaultPageSchema` / `buildDefaultTabs` emit no stream tab and no `record:activity` node, and the wide layout draws no 动态 column. With any one source on, the tab is drawn as before. A `relatedLists` entry `'sys_activity'` on such an object does not bring the tab back. An authored page, or an authored `discussion` slot, still draws what its author placed. The Approvals tab is unchanged: it is drawn only when the record has approval requests.

‎content/docs/ui/pages.mdx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,10 @@ and related-list columns). A relationship whose child field declares `relatedLis
190190
is part of the record's body: its list is a full-width table in the details, after the field
191191
sections drawn open, with no tab of its own. **动态**
192192
(`?related=timeline`) holds the record's system entries: its activity and, with
193-
`enable: { trackHistory: true }`, its field changes; there is no separate History tab. On the
193+
`enable: { trackHistory: true }`, its field changes; there is no separate History tab. An object
194+
with `enable: { feeds: false, activities: false }` and no `trackHistory` gives the stream
195+
nothing to show, so its page draws no **动态** tab, and a `relatedLists` entry
196+
`'sys_activity'` does not bring it back. On the
194197
desktop the record's comments are not in it but in the comment panel, opened from the
195198
comments icon in the record header ([the record's comment panel](/docs/frontend/plugins/plugin-detail#the-records-comment-panel)); on a phone they are still
196199
in **动态**, with its All / Activity / Discussion / Changes filter. A list's tab is that list's

‎ui/packages/plugin-detail/README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,9 @@ the console — and a double-click keeps the default there too.
919919
A tab row closes the record header (`RecordTabRow`): 「详情」 (Details) where
920920
the details are not pinned, then one tab per related list in the reader's
921921
arrangement, then Attachments, Approvals, and 动态 (Activity) last, each with
922-
its count. A tab is its panel's whole face: choosing it draws the full list
922+
its count. 动态 is left out for an object that switches off all three of its
923+
sources (`enable.feeds` and `enable.activities` false, `enable.trackHistory`
924+
not true), since that stream would be empty. A tab is its panel's whole face: choosing it draws the full list
923925
(every column, paging, sort, inline edit) or the full stream below the row,
924926
with the header unchanged, and the URL carries it
925927
(`?related=<object>.<field>`, `?related=timeline`); 「详情」 or Esc returns

‎ui/packages/plugin-detail/src/synth/__tests__/buildDefaultPageSchema.test.ts‎

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,71 @@ describe('buildDefaultPageSchema', () => {
676676
expect(tabItems(tabs)[0].children[0].id).toBe('custom-details');
677677
});
678678
});
679+
680+
// objectstack#36693 — the activity stream tab follows the object's switches
681+
// for its three sources, as Attachments follows `enable.files`: with the
682+
// discussion (`feeds`), the activity (`activities`) and the field changes
683+
// (`trackHistory`) all off there is nothing to draw, so no tab.
684+
describe('activity stream tab follows its sources (objectstack#36693)', () => {
685+
const allOff = { feeds: false, activities: false };
686+
const values = (page: any) =>
687+
tabItems(page.regions[0].components.find((c: any) => c.type === 'page:tabs')).map((t: any) => t.value);
688+
const nodePayload = {
689+
approvals: { available: true, requests: [{ id: 'req_1' }], pendingRequest: null },
690+
currentUserId: 'u_1',
691+
};
692+
693+
it('all three sources off → no stream tab and no record:activity anywhere', () => {
694+
const page = buildDefaultPageSchema({ ...leadDef, enable: allOff });
695+
expect(values(page)).toEqual(['details']);
696+
expect(JSON.stringify(page)).not.toContain('record:activity');
697+
// `trackHistory: false` written out reads the same as absent.
698+
expect(values(buildDefaultPageSchema({ ...leadDef, enable: { ...allOff, trackHistory: false } }))).toEqual(['details']);
699+
const tabs = buildDefaultTabs({ ...leadDef, enable: allOff }, {
700+
related: [{ objectName: 'task', relationshipField: 'lead_id' }],
701+
});
702+
expect(tabItems(tabs).map((t: any) => t.value)).toEqual(['details', 'related:task.lead_id']);
703+
});
704+
705+
it('any one source on → the stream tab is drawn as before (control, one key each)', () => {
706+
expect(values(buildDefaultPageSchema({ ...leadDef, enable: { ...allOff, feeds: true } }))).toEqual(['details', 'timeline']);
707+
expect(values(buildDefaultPageSchema({ ...leadDef, enable: { ...allOff, activities: true } }))).toEqual(['details', 'timeline']);
708+
expect(values(buildDefaultPageSchema({ ...leadDef, enable: { ...allOff, trackHistory: true } }))).toEqual(['details', 'timeline']);
709+
// `feeds` / `activities` are opt-out: absent is on.
710+
expect(values(buildDefaultPageSchema({ ...leadDef, enable: { feeds: false } }))).toEqual(['details', 'timeline']);
711+
expect(values(buildDefaultPageSchema({ ...leadDef, enable: { activities: false } }))).toEqual(['details', 'timeline']);
712+
});
713+
714+
it("a 'sys_activity' entry in relatedLists does not bring back an empty stream tab", () => {
715+
const page = buildDefaultPageSchema({ ...leadDef, enable: allOff, relatedLists: ['sys_activity'] });
716+
expect(values(page)).toEqual(['details']);
717+
// CONTROL: with a source on, the same entry places the tab.
718+
const live = buildDefaultPageSchema({ ...leadDef, enable: { ...allOff, feeds: true }, relatedLists: ['sys_activity'] });
719+
expect(values(live)).toEqual(['details', 'timeline']);
720+
});
721+
722+
it('an authored discussion slot still draws, whatever the switches say', () => {
723+
const page = buildDefaultPageSchema({ ...leadDef, enable: allOff }, {
724+
slots: { discussion: { type: 'div', id: 'custom-discussion' } },
725+
});
726+
const timeline = tabItems(page.regions[0].components.find((c: any) => c.type === 'page:tabs'))
727+
.find((t: any) => t.value === 'timeline');
728+
expect(timeline.children).toEqual([{ type: 'div', id: 'custom-discussion' }]);
729+
});
730+
731+
it('CONTROL: Approvals is unchanged, drawn only when the record has requests', () => {
732+
const def = { ...leadDef, enable: allOff };
733+
expect(values(buildDefaultPageSchema(def))).toEqual(['details']);
734+
expect(values(buildDefaultPageSchema(def, { approvals: { count: 1, node: nodePayload } }))).toEqual(['details', 'approvals']);
735+
});
736+
737+
it('a details slot override keeps the gate', () => {
738+
const page = buildDefaultPageSchema({ ...leadDef, enable: allOff }, {
739+
slots: { details: { type: 'div', id: 'custom-details' } },
740+
});
741+
expect(values(page)).toEqual(['details']);
742+
});
743+
});
679744
});
680745

681746
// ADR-0085 — top-level semantic roles (stageField / highlightFields).

‎ui/packages/plugin-detail/src/synth/buildDefaultPageSchema.ts‎

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,15 @@ export interface ObjectDefLike {
9898
*/
9999
fieldGroups?: Array<Partial<NonNullable<ServiceObject['fieldGroups']>[number]>>;
100100
/**
101-
* Spec `enable` capability toggles. Only `files` is read here:
102-
* `enable.files === true` (opt-in, objectstack-ai/objectstack#2727) makes the synthesizer emit an
103-
* Attachments tab beside Details/Related (objectstack#4358).
101+
* Spec `enable` capability toggles. `enable.files === true` (opt-in,
102+
* objectstack-ai/objectstack#2727) makes the synthesizer emit an
103+
* Attachments tab beside Details/Related (objectstack#4358). The activity
104+
* stream tab follows the stream's three sources (objectstack#36693): it is
105+
* left out when `feeds` and `activities` are both `false` (opt-out, spec
106+
* default on) and `trackHistory` is not `true` (opt-in), since such a
107+
* stream has nothing to draw (`streamHasSource`).
104108
*/
105-
enable?: { files?: boolean; [key: string]: any };
109+
enable?: { files?: boolean; feeds?: boolean; activities?: boolean; trackHistory?: boolean; [key: string]: any };
106110
/**
107111
* The spec's `relatedLists` (objectstack#35897): the record page's tabs
108112
* beside the overview, in order. Read here for the three built-in tab names
@@ -990,7 +994,7 @@ export function buildDefaultTabs(
990994
/**
991995
* The Timeline tab's content (objectstack#27055); `buildDefaultPageSchema`
992996
* passes the `discussion` slot here. Absent: the default stream, unless
993-
* `hideDiscussion`.
997+
* `hideDiscussion` or the object's stream has no source (objectstack#36693).
994998
*/
995999
timeline?: any[];
9961000
} = {},
@@ -1072,7 +1076,7 @@ function synthTabs(
10721076
// (objectstack#34590 kept the stream last). The stream tab's token is
10731077
// `Activity stream`, which the strip reads as `detail.timeline` (「动态」); a
10741078
// bare `Timeline` is an author's word.
1075-
const timeline = options.timeline ?? (options.hideDiscussion ? [] : [buildDefaultTimeline()]);
1079+
const timeline = options.timeline ?? (options.hideDiscussion || !streamHasSource(def) ? [] : [buildDefaultTimeline()]);
10761080
for (const rel of sides) {
10771081
items.push({
10781082
label: rel.title ?? rel.objectName,
@@ -1192,6 +1196,24 @@ export function buildDefaultDiscussion(): any {
11921196
return componentNode('record:discussion');
11931197
}
11941198

1199+
/**
1200+
* objectstack#36693 — whether the default record page's activity stream has a
1201+
* source to draw. The stream merges three, each switched by the object
1202+
* (`buildDefaultTimeline`): the discussion (`enable.feeds`, opt-out), the
1203+
* activity (`enable.activities`, opt-out) and the field changes
1204+
* (`enable.trackHistory`, opt-in; a field's own `trackHistory` /
1205+
* `fieldHistory` only decide whether a change shows its values). With all
1206+
* three off the 动态 tab would be empty, so the synthesizer leaves it out, the
1207+
* way the Attachments tab follows `enable.files`. A `relatedLists` entry
1208+
* `'sys_activity'` does not bring it back (`arrangeDeclaredTabs` only places
1209+
* tabs that were built). An authored page, or an authored `discussion` slot,
1210+
* draws what its author placed.
1211+
*/
1212+
function streamHasSource(def: ObjectDefLike | undefined): boolean {
1213+
const enable = def?.enable;
1214+
return enable?.feeds !== false || enable?.activities !== false || enable?.trackHistory === true;
1215+
}
1216+
11951217
/**
11961218
* Sub-builder: the timeline stream (objectstack#27055, Target 3) — ONE
11971219
* `record:activity` merging the discussion (`enable.feeds`), the activity
@@ -1287,11 +1309,12 @@ export function buildDefaultPageSchema(
12871309
}
12881310

12891311
// The timeline stream's content (objectstack#27055): an authored
1290-
// `discussion` slot replaces it; `hideDiscussion` drops it.
1312+
// `discussion` slot replaces it; `hideDiscussion` drops it, and so does an
1313+
// object whose stream has no source (objectstack#36693, `streamHasSource`).
12911314
const timeline =
12921315
'discussion' in slots && slots.discussion !== undefined
12931316
? toNodeArray(slots.discussion)
1294-
: options.hideDiscussion
1317+
: options.hideDiscussion || !streamHasSource(def)
12951318
? []
12961319
: [buildDefaultTimeline()];
12971320

0 commit comments

Comments
 (0)