Skip to content

Commit 28ba01f

Browse files
fix(plugin-detail): a slotted page's record:chatter on the 动态 tab lists the system history alone while the comment panel holds the comments (#36193) (#36221)
<!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuCeTM2qYEuA9dNQrrsVbmgv)_ repo:objectstack#1 · os-sales · session_01L6bhgXV5qLuX94Bn6aqb4y Fixes #36193 > **Premise.** > 1. What the card reads now: #36136 (48c732c) retired the overview's right rail, so the 「最近动态」 card is gone and the overview lists no comment. The card's 「讨论 (3)」 face came from a slotted page whose `discussion` slot holds `record:chatter`; after #36136 that author's block is drawn on the 动态 tab only, where it still drew 「讨论 (4)」, the 全部动态 filter, every comment and reply and a comment box, beside the comment panel showing the same comment (before: `pr36136/timeline-tab-panel-open-*`). > 2. Reading (seat, 2026-11-21 23:06Z): the card's 「不改动态页签」 means the platform's own 动态 tab (its label and the stream the platform draws). The target is the author-placed chatter/discussion block, which now happens to sit inside that tab. > 3. `Clause-②: no` (a UI face of an existing block; no contract, permission or spec key). ## What changes - `renderers/record-chatter.tsx`: while `RecordCommentsInPanelContext` is on and the block is on the default/slotted page (`useDefaultRecordPage()`), a `record:chatter` / `record:discussion` block draws the system entries only: comments and replies filtered out before `applyFeedConfig`, no composer (`onAddComment` withheld, `commentsShown: false`, which also drops the Comments-only filter), a refused or failed comment read not reported (the panel's to say), heading 「动态」 (`detail.timeline`) and empty line `detail.noActivity`. The `(N)` count is the filtered items, so it leaves comments out. - `RecordChatterPanel.tsx`: optional `titleLabel` / `emptyLabel` props (default 「讨论」 / 「暂无评论」, unchanged for every other caller); a caller-named heading takes the stream's `Activity` icon instead of `MessageSquare` (L1-c nit, 3efc293). - Test `renderers/__tests__/record-chatter.commentsInPanel-36193.test.tsx` (6). Not changed: the platform's own `record:activity` stream, the 动态 tab's label (still 「动态」, no count), an authored (`kind: 'full'`) page. **Phone, after #36208 (merged into this branch at `abe8f8b5`):** #36208 sets `RecordCommentsInPanelContext` to the panel OR the phone comment page, so on the phone too the author's block on the 动态 tab now drops its comments; the phone's comments live on their own page. Before #36208 the phone had no comment surface and kept them. ### Small calls (seat may overrule) 1. Heading is 「动态」, matching the platform stream's heading in the same tab; the 全部动态 filter stays (its Comments-only entry goes). 2. The switch is "comment panel offered", not "open", as #36114 uses for the stream. ## Why Card #36193 (epic #36062 phase 1 wrap-up): with the comment panel open the same comment showed twice, and a resolved thread stayed in the record body. ## Verification - New test 6/6. Ablation (renderer + panel reverted to main): 4 red, the 2 CONTROL cases green. - plugin-detail chatter / timeline / RecordPageColumns / renderers suites: 123 files, 1,274 tests green. app-shell suites naming `record:chatter` / discussion slots / the comment panel: 14 files, 221 tests green. - Browser: HotCRM main on `objectstack dev`, console on Vite from this branch, zh-CN, 1440, dpr 2, one comment + one reply on Wayne Enterprises, a local uncommitted slotted `crm_account` page with `slots.discussion: [record:chatter]`. Evidence in the project folder `build-seat1/36193/`: - before (main after #36136): `pr36136/timeline-tab-panel-open-{light,dark}.png`: 「讨论 (4)」, the comment and 「1 条回复」 beside the panel. - after: `after/timeline-tab-panel-open-{light,dark}.png`: 「动态 (2)」, two system rows, no comment box; `after/overview-panel-open-*`: no comment on the overview; tab row 「… 活动 5 动态」 unchanged. - phone: `after/phone-timeline-tab-light.png`: still 「讨论 (4)」 with the comment (no comment surface on the phone yet). - Drawer: the comment panel is offered in the drawer too (#36114), so the author's block in the drawer's 动态 tab follows the same rule as on the page. - Overlap: `overlap-check.mjs` clean against main (c30ce97, after #36208) and open heads. Clause-②: no Metadata-protocol: none ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (not touched) - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes. (eslint on the three files: 0 errors) - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: n/a. - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. - [x] The *Before Submitting* list in CONTRIBUTING.md is done. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgXV5qLuX94Bn6aqb4y <!-- signed: repo:objectstack#1 · os-sales · session_01L6bhgXV5qLuX94Bn6aqb4y --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 337f435 commit 28ba01f

4 files changed

Lines changed: 151 additions & 17 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
'@object-ui/plugin-detail': patch
3+
---
4+
5+
fix(plugin-detail): a slotted page's record:chatter on the 动态 tab lists the system history alone while the comment panel holds the comments
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
- A page whose `discussion` slot holds `record:chatter` or `record:discussion` draws that block on the record page's 动态 tab. While the comment panel is offered beside the record, on the page or in the drawer (objectstack#36075), the block now draws the system entries alone, as the platform's own 动态 stream does there: no comment and no reply, no comment box, no Comments-only filter, a count without the comments, the 动态 heading instead of 「讨论」, and the activity empty line instead of 「暂无评论」. A refused or failed comment read is the panel's to report, not this block's.
11+
- Not changed: the platform's own 动态 stream, the 动态 tab's label, a page an author composed whole, and the phone while it has no comment surface.

‎ui/packages/plugin-detail/src/RecordChatterPanel.tsx‎

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import * as React from 'react';
1010
import { cn, Button } from '@object-ui/components';
11-
import { MessageSquare, PanelRightOpen, PanelRightClose, X } from 'lucide-react';
11+
import { Activity, MessageSquare, PanelRightOpen, PanelRightClose, X } from 'lucide-react';
1212
import type { RecordChatterComponentProps, FeedItem, RecordSubscription } from '@object-ui/types';
1313
import { RecordActivityTimeline } from './RecordActivityTimeline';
1414
import type { FeedFilterMode } from './RecordActivityTimeline';
@@ -94,6 +94,13 @@ export interface RecordChatterPanelProps {
9494
commentsFailed?: boolean;
9595
/** Read the failed feed reads again; forwarded to the timeline's Retry. */
9696
onRetryFeed?: () => void;
97+
/**
98+
* The panel's heading, in place of 「讨论」, and its empty line, in place of
99+
* 「暂无评论」. The renderer names them when the panel holds no comments
100+
* (objectstack#36193: the comment panel holds them).
101+
*/
102+
titleLabel?: string;
103+
emptyLabel?: string;
97104
className?: string;
98105
}
99106

@@ -131,6 +138,8 @@ export const RecordChatterPanel: React.FC<RecordChatterPanelProps> = ({
131138
activityFailed,
132139
commentsFailed,
133140
onRetryFeed,
141+
titleLabel,
142+
emptyLabel,
134143
className,
135144
}) => {
136145
const position = config?.position ?? 'right';
@@ -139,6 +148,10 @@ export const RecordChatterPanel: React.FC<RecordChatterPanelProps> = ({
139148
const defaultCollapsed = (collapseWhenEmpty && items.length === 0) || (config?.defaultCollapsed ?? false);
140149

141150
const { t } = useDetailTranslation();
151+
const title = titleLabel ?? t('detail.discussion');
152+
// A heading named by the caller (动态, objectstack#36193) takes the stream's icon.
153+
const TitleIcon = titleLabel ? Activity : MessageSquare;
154+
const empty = emptyLabel ?? t('detail.noCommentsYet');
142155
const [collapsed, setCollapsed] = React.useState(defaultCollapsed);
143156
/**
144157
* The feed's own `aria` bag (objectui#11083). The spec declares `feed` as
@@ -204,8 +217,8 @@ export const RecordChatterPanel: React.FC<RecordChatterPanelProps> = ({
204217
{/* Header */}
205218
<div className="flex items-center justify-between px-4 py-3 border-b">
206219
<div className="flex items-center gap-2">
207-
<MessageSquare className="h-4 w-4" />
208-
<span className="text-sm font-medium">{t('detail.discussion')}</span>
220+
<TitleIcon className="h-4 w-4" />
221+
<span className="text-sm font-medium">{title}</span>
209222
</div>
210223
{collapsible && (
211224
<Button
@@ -243,8 +256,8 @@ export const RecordChatterPanel: React.FC<RecordChatterPanelProps> = ({
243256
mentionSuggestions={mentionSuggestions}
244257
onMentionSuggestionsWanted={onMentionSuggestionsWanted}
245258
onUploadAttachments={onUploadAttachments}
246-
titleLabel={t('detail.discussion')}
247-
emptyLabel={t('detail.noCommentsYet')}
259+
titleLabel={title}
260+
emptyLabel={empty}
248261
activityDenied={activityDenied}
249262
commentsDenied={commentsDenied}
250263
activityFailed={activityFailed}
@@ -276,8 +289,8 @@ export const RecordChatterPanel: React.FC<RecordChatterPanelProps> = ({
276289
{collapsible && (
277290
<div className="flex items-center justify-between mb-2">
278291
<div className="flex items-center gap-2 text-sm font-medium">
279-
<MessageSquare className="h-4 w-4" />
280-
{t('detail.discussion')}
292+
<TitleIcon className="h-4 w-4" />
293+
{title}
281294
</div>
282295
<Button
283296
variant="ghost"
@@ -311,8 +324,8 @@ export const RecordChatterPanel: React.FC<RecordChatterPanelProps> = ({
311324
mentionSuggestions={mentionSuggestions}
312325
onMentionSuggestionsWanted={onMentionSuggestionsWanted}
313326
onUploadAttachments={onUploadAttachments}
314-
titleLabel={t('detail.discussion')}
315-
emptyLabel={t('detail.noCommentsYet')}
327+
titleLabel={title}
328+
emptyLabel={empty}
316329
activityDenied={activityDenied}
317330
commentsDenied={commentsDenied}
318331
activityFailed={activityFailed}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/**
2+
* ObjectUI
3+
* Copyright (c) 2024-present ObjectStack Inc.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
/**
10+
* objectstack#36193 — a slotted page's `discussion` slot holding
11+
* `record:chatter` (or `record:discussion`) is drawn on the record page's 动态
12+
* tab. While the comment panel beside the record holds the comments
13+
* (objectstack#36075), that block draws the system entries alone: no comment
14+
* and no reply, no composer, no Comments-only filter, a count without the
15+
* comments, and the 动态 heading rather than 「讨论」.
16+
*
17+
* CONTROLS: without the panel (the phone, or no host saying), and off the
18+
* default page (a page an author composed whole), the block is as it was.
19+
*/
20+
21+
import * as React from 'react';
22+
import { describe, it, expect, afterEach } from 'vitest';
23+
import { render, cleanup } from '@testing-library/react';
24+
import { DiscussionContextProvider } from '@object-ui/react';
25+
import type { FeedItem } from '@object-ui/types';
26+
import { RecordChatterRenderer } from '../record-chatter';
27+
import { RecordCommentsInPanelContext } from '../../recordTimelineStream';
28+
import { DefaultRecordPageContext } from '../../defaultRecordPage';
29+
30+
afterEach(cleanup);
31+
32+
const comment: FeedItem = { id: 'c1', type: 'comment', actor: 'Ada', body: 'Follow up on the renewal quote', createdAt: '2026-11-21T10:00:00Z' };
33+
const reply: FeedItem = { id: 'c2', type: 'comment', actor: 'Ada', body: 'Got it', parentId: 'c1', createdAt: '2026-11-21T10:05:00Z' };
34+
const system: FeedItem = { id: 's1', type: 'system', actor: 'System', body: 'Owner changed to Ada', createdAt: '2026-11-20T09:00:00Z' };
35+
36+
function mount({
37+
inPanel,
38+
onDefaultPage = true,
39+
items = [system, comment, reply],
40+
type = 'record:chatter',
41+
commentsDenied = false,
42+
}: { inPanel: boolean; onDefaultPage?: boolean; items?: FeedItem[]; type?: string; commentsDenied?: boolean }) {
43+
return render(
44+
<DefaultRecordPageContext.Provider value={onDefaultPage}>
45+
<RecordCommentsInPanelContext.Provider value={inPanel}>
46+
<DiscussionContextProvider items={items as any[]} loading={false} commentsDenied={commentsDenied} onAddComment={() => undefined}>
47+
<RecordChatterRenderer schema={{ type, position: 'bottom', collapsible: false } as any} />
48+
</DiscussionContextProvider>
49+
</RecordCommentsInPanelContext.Provider>
50+
</DefaultRecordPageContext.Provider>,
51+
);
52+
}
53+
54+
const heading = (container: HTMLElement) => container.querySelector('h2')?.textContent ?? '';
55+
56+
describe('record:chatter on the 动态 tab while the comments are in the panel (objectstack#36193)', () => {
57+
it.each(['record:chatter', 'record:discussion'])('%s: system entries only, no comment box, no Discussion heading, the count without comments', (type) => {
58+
const { container } = mount({ inPanel: true, type });
59+
expect(container.textContent).toContain('Owner changed to Ada');
60+
expect(container.textContent).not.toContain('Follow up on the renewal quote');
61+
expect(container.textContent).not.toContain('Got it');
62+
expect(container.querySelector('textarea')).toBeNull();
63+
expect(heading(container)).not.toMatch(/Discussion/);
64+
expect(container.querySelector('[data-testid="activity-count"]')?.textContent).toContain('1');
65+
});
66+
67+
it('no system history: the empty line names activity, not comments', () => {
68+
const { container } = mount({ inPanel: true, items: [comment, reply] });
69+
expect(container.textContent).not.toContain('Follow up on the renewal quote');
70+
expect(container.textContent).not.toMatch(/No comments yet/);
71+
});
72+
73+
it('a refused comment read is the panel\'s to say, not this block\'s', () => {
74+
const { container } = mount({ inPanel: true, commentsDenied: true });
75+
expect(container.textContent).toContain('Owner changed to Ada');
76+
expect(container.querySelector('[data-testid="activity-count"]')?.textContent).toContain('1');
77+
});
78+
79+
it('CONTROL — without the panel (the phone) the block keeps its comments, composer and heading', () => {
80+
const { container } = mount({ inPanel: false });
81+
expect(container.textContent).toContain('Follow up on the renewal quote');
82+
expect(container.querySelector('textarea')).toBeTruthy();
83+
expect(heading(container)).toMatch(/Discussion/);
84+
});
85+
86+
it('CONTROL — off the default page (an authored page) the flag changes nothing', () => {
87+
const { container } = mount({ inPanel: true, onDefaultPage: false });
88+
expect(container.textContent).toContain('Follow up on the renewal quote');
89+
expect(container.querySelector('textarea')).toBeTruthy();
90+
});
91+
});

‎ui/packages/plugin-detail/src/renderers/record-chatter.tsx‎

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ import {
119119
} from './recordActivityFeed';
120120
import { useRecordAriaProps } from './recordComponentAria';
121121
import { useDefaultRecordPage } from '../defaultRecordPage';
122-
import { RecordFieldChangesContext, RecordFieldHistoryContext, mergeFieldHistoryIntoFeed } from '../recordTimelineStream';
122+
import { RecordCommentsInPanelContext, RecordFieldChangesContext, RecordFieldHistoryContext, mergeFieldHistoryIntoFeed } from '../recordTimelineStream';
123+
import { useDetailTranslation } from '../useDetailTranslation';
123124

124125
/** Dev mode, read per call — the guard `record-activity.tsx` puts on the same diagnostic. */
125126
const isDevBuild = (): boolean =>
@@ -257,10 +258,23 @@ export const RecordChatterRenderer: React.FC<RecordChatterRendererProps> = ({
257258
const onDefaultPage = useDefaultRecordPage();
258259
const fieldHistoryShown =
259260
React.useContext(RecordFieldHistoryContext) && !onDefaultPage && feed?.unifiedTimeline !== false;
261+
// objectstack#36193 — a slotted page's chatter is drawn on the record page's
262+
// 动态 tab. While the comment panel beside the record holds the comments
263+
// (objectstack#36075), this block draws the system entries alone, as the
264+
// platform's own stream does there: no comment and no reply, no composer,
265+
// no Comments-only filter, a count without the comments, and the 动态
266+
// heading rather than 「讨论」. Off the default page (an authored page), and
267+
// on the phone (no panel), the block is as it was.
268+
const commentsInPanel = React.useContext(RecordCommentsInPanelContext) && onDefaultPage;
269+
const { t } = useDetailTranslation();
270+
const sourceItems = React.useMemo(
271+
() => (commentsInPanel ? (discussionItems ?? []).filter((item) => item.type !== 'comment') : discussionItems ?? []),
272+
[commentsInPanel, discussionItems],
273+
);
260274
const applied = React.useMemo(
261275
() =>
262276
applyFeedConfig(
263-
onDefaultPage ? discussionItems ?? [] : mergeFieldHistoryIntoFeed(discussionItems ?? [], fieldChanges),
277+
onDefaultPage ? sourceItems : mergeFieldHistoryIntoFeed(sourceItems, fieldChanges),
264278
{
265279
types: feed?.types,
266280
showCompleted: feed?.showCompleted,
@@ -269,7 +283,7 @@ export const RecordChatterRenderer: React.FC<RecordChatterRendererProps> = ({
269283
pageSize,
270284
blockName,
271285
),
272-
[discussionItems, onDefaultPage, fieldChanges, feed?.types, feed?.showCompleted, feed?.unifiedTimeline, pageSize, blockName],
286+
[sourceItems, onDefaultPage, fieldChanges, feed?.types, feed?.showCompleted, feed?.unifiedTimeline, pageSize, blockName],
273287
);
274288

275289
// `record-activity.tsx` writes its own `handleLoadMore` with an empty
@@ -288,8 +302,9 @@ export const RecordChatterRenderer: React.FC<RecordChatterRendererProps> = ({
288302
// predicate and the same block name `applyFeedConfig` filters by
289303
// (objectstack#34525). Where the composer would have been offered, the
290304
// author is told why once, in development.
291-
const commentsShown = feedTypesAdmitComments(feed?.types, blockName);
292-
const composerWithheld = !commentsShown && feed?.showCommentInput !== false;
305+
const typesAdmitComments = feedTypesAdmitComments(feed?.types, blockName);
306+
const commentsShown = typesAdmitComments && !commentsInPanel;
307+
const composerWithheld = !typesAdmitComments && feed?.showCommentInput !== false;
293308
const nodeId: string | undefined = typeof schema.id === 'string' ? schema.id : undefined;
294309
const typesKey = JSON.stringify(feed?.types ?? null);
295310
React.useEffect(() => {
@@ -328,7 +343,7 @@ export const RecordChatterRenderer: React.FC<RecordChatterRendererProps> = ({
328343
// renderer was the only missing end of the wire.
329344
filterMode={filterMode}
330345
onFilterChange={setFilterMode}
331-
onAddComment={discussion?.onAddComment as any}
346+
onAddComment={commentsInPanel ? undefined : (discussion?.onAddComment as any)}
332347
commentsShown={commentsShown}
333348
onAddReply={discussion?.onAddReply as any}
334349
onToggleReaction={discussion?.onToggleReaction as any}
@@ -343,11 +358,15 @@ export const RecordChatterRenderer: React.FC<RecordChatterRendererProps> = ({
343358
// REFUSED. The host that owns the fetch decides it, the same way it
344359
// decides `loading` above; the panel only renders it.
345360
activityDenied={discussion?.activityDenied}
346-
commentsDenied={discussion?.commentsDenied}
361+
// A refused or failed comment read is the comment panel's to say.
362+
commentsDenied={!commentsInPanel && discussion?.commentsDenied}
347363
// objectstack#29188: which of them FAILED (5xx, network), and the
348364
// host's re-read of those; the panel only renders it.
349365
activityFailed={discussion?.activityFailed}
350-
commentsFailed={discussion?.commentsFailed}
366+
commentsFailed={!commentsInPanel && discussion?.commentsFailed}
367+
{...(commentsInPanel
368+
? { titleLabel: t('detail.timeline', { defaultValue: 'Activity' }), emptyLabel: t('detail.noActivity', { defaultValue: 'No activity recorded' }) }
369+
: {})}
351370
onRetryFeed={discussion?.onRetryFeed}
352371
/>
353372
</RecordFieldHistoryContext.Provider>

0 commit comments

Comments
 (0)