Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/27356-studio-publish-toast-names-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@object-ui/app-shell': patch
'@object-ui/i18n': patch
---

feat(studio): publishing the organization's own flows names them in the toast

Clause-②: no
Metadata-protocol: none

On Studio's Organization flows scope (flows in no package), publishing drafts used to toast "Published 1 package-less flow draft", which said neither which flow went live nor in plain words. One published flow now reads `Published flow "Lead follow-up"`, by its label (its machine name when it has none). Several read `Published 3 flows` with their names listed under it. A refusal and the nothing-pending answer are unchanged.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const published = (...names: string[]) =>
names.map((name, i) => ({ type: 'object', name, version: `sha256:${i}` }));

let batchBody: unknown;
let orgDrafts: Array<{ type: string; name: string; packageId: null }> = [];
let orgDrafts: Array<{ type: string; name: string; packageId: null; label?: string }> = [];
/** Every publish request the surface sent: the batch door and the by-reference one. */
const posts: string[] = [];

Expand Down Expand Up @@ -241,6 +241,26 @@ describe('the package-less publish names its count, and its zero is no success (
expect(toasts().success).toEqual([tFormat('engine.studio.publishedAllFlows', 'en', { count: 2 })]);
});

// #27356 row 18 (hotcrm#2320 Studio S7): the toast names what went live.
it('one package-less flow draft: the toast names it by its label', async () => {
orgDrafts = [{ type: 'flow', name: 'qa_alert_clone', packageId: null, label: 'QA alert (copy)' }];
await publishAt('/studio/~org/automations', 1);
await waitFor(() => expect(toast.success).toHaveBeenCalled());
expect(toasts().success).toEqual([tFormat('engine.studio.publishedAllFlowsOne', 'en', { label: 'QA alert (copy)' })]);
expect(toasts().success[0]).toContain('QA alert (copy)');
});

it('several: the count row, the flows named in the description (label, else name)', async () => {
orgDrafts = [
{ type: 'flow', name: 'qa_alert_clone', packageId: null, label: 'QA alert (copy)' },
{ type: 'flow', name: 'qa_digest_clone', packageId: null },
];
await publishAt('/studio/~org/automations', 2);
await waitFor(() => expect(toast.success).toHaveBeenCalled());
const description = (vi.mocked(toast.success).mock.calls[0][1] as { description?: string } | undefined)?.description;
expect(description).toBe('QA alert (copy), qa_digest_clone');
});

it('none pending by the time of the read: no success claimed', async () => {
orgDrafts = [];
await publishAt('/studio/~org/automations', 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1761,14 +1761,17 @@ export function StudioDesignSurface({ aiSlot }: StudioDesignSurfaceProps): React
} else {
// objectui#11807 — how many went live: every draft read above, as
// none failed.
// The toast names what went live: one flow in its title, several
// by count with their names in the description.
setPublishRefusals(NO_PUBLISH_REFUSALS);
toast.success(
tFormat(
pending.length === 1 ? 'engine.studio.publishedAllFlowsOne' : 'engine.studio.publishedAllFlows',
locale,
{ count: pending.length },
),
);
const names = pending.map((d) => resolveI18nLabel(d.label, locale)?.trim() || d.name);
if (names.length === 1) {
toast.success(tFormat('engine.studio.publishedAllFlowsOne', locale, { label: names[0] }));
} else {
toast.success(tFormat('engine.studio.publishedAllFlows', locale, { count: names.length }), {
description: names.join(', '),
});
}
setChangesOpen(false);
}
setPublishNonce((n) => n + 1);
Expand Down
4 changes: 2 additions & 2 deletions ui/packages/i18n/src/namespaces/studio/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3126,8 +3126,8 @@ const STUDIO_EN: Record<string, string> = {
'engine.studio.org.none': 'No flows outside a package yet. Clone a packaged flow in Setup › Packaged automation to edit the copy here.',
// objectui#12513 — the empty block's way to that Setup list: a link, since this scope creates nothing.
'engine.studio.org.openSetup': 'Open in Setup',
'engine.studio.publishedAllFlows': 'Published {count} package-less flow drafts',
'engine.studio.publishedAllFlowsOne': 'Published {count} package-less flow draft',
'engine.studio.publishedAllFlows': 'Published {count} flows',
'engine.studio.publishedAllFlowsOne': 'Published flow "{label}"',
'engine.studio.designer.search': 'Search…',
'engine.studio.designer.select': 'Select…',
'engine.studio.designer.pickDate': 'Pick a date…',
Expand Down
4 changes: 2 additions & 2 deletions ui/packages/i18n/src/namespaces/studio/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2777,8 +2777,8 @@ const STUDIO_ZH: Record<string, string> = {
'engine.studio.org.description': '本组织自有、不属于任何软件包的流程,例如软件包流程的克隆副本。可直接编辑。',
'engine.studio.org.none': '还没有不属于软件包的流程。在 设置 › 打包自动化 中克隆一个软件包流程,即可在这里编辑副本。',
'engine.studio.org.openSetup': '在设置中打开',
'engine.studio.publishedAllFlows': '已发布 {count} 个不属于软件包的流程草稿',
'engine.studio.publishedAllFlowsOne': '已发布 {count} 个不属于软件包的流程草稿',
'engine.studio.publishedAllFlows': '已发布 {count} 个流程',
'engine.studio.publishedAllFlowsOne': '已发布流程「{label}」',
'engine.studio.designer.search': '搜索…',
'engine.studio.designer.select': '请选择…',
'engine.studio.designer.pickDate': '选择日期…',
Expand Down
Loading