Skip to content

Commit a06c980

Browse files
matt2eclaude
andcommitted
feat(messages): trim the workflow message card to a hover heads-up
The ⓘ card on a workflow kick-off message repeated the owner's name from the byline beside it and printed the owner and relay npubs in full. At about 224 × 438 px it covered the message it described. The card now shows its title and one plain description: "Sent automatically by a workflow. Its owner set it up but didn't send this message personally." The owner and relay keys, the owner row and the "run details not included" footer are gone. The relay signing key is no longer shown anywhere in the UI, which changes the disclosure agreed in #663; docs/workflows.md now describes the card instead. The owner's npub is still reachable from the byline's profile link, which offers Copy npub. The trigger uses the shared PopoverTrigger openOnHover="preview" bucket, so the card opens after a 0.3 s pointer rest. Enter and click still open it, and Escape closes it and returns focus to ⓘ. Base UI does not move focus for a hover open, and a click right after a hover open keeps the card open. The IconButton has no title, so no hint tooltip competes with the card. WorkflowByline no longer takes a signer prop, and the unused .workflowDetails rules are deleted. The signerId field on ChannelMessage stays; removing it is a separate cleanup. The gallery specimen description is updated. Tests: the MessageRow tests now cover the Enter/Escape/click path, the card's description with no npub or owner name, and a hover test showing that nothing opens at 299 ms, the card opens at 300 ms with no tooltip and no focus move, a click keeps it open and Escape closes it. The hover test fails without openOnHover. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Matt Toohey <[email protected]>
1 parent 8668dbd commit a06c980

6 files changed

Lines changed: 81 additions & 64 deletions

File tree

‎docs/workflows.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,11 @@ writes require separate consent; no backend work belongs to this plugin PR.
210210

211211
Relay-attested workflow messages show an automation icon and **Workflow · owned
212212
by …**, not a message authored by the owner. The full message byline links the
213-
owner profile and discloses the separate relay signing key. Compact Search,
214-
Inbox/activity, link previews and notification titles retain the automation label;
215-
opening the message provides the full disclosure. Notifications use cached names
216-
only and do not add profile reads.
213+
owner profile. Its information icon opens a short card, on pointer rest or click,
214+
explaining that the owner set up the workflow but did not send the message
215+
personally; it shows no keys. Compact Search, Inbox/activity, link previews and
216+
notification titles retain the automation label; opening the message shows the
217+
full byline. Notifications use cached names only and do not add profile reads.
217218

218219
Attribution requires a verified kind-9 event from the selected community's
219220
explicit NIP-11 `self`, exactly one canonical `buzz:workflow=true` marker and one

‎src/features/messages/MessageRow.test.tsx‎

Lines changed: 72 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import { StrictMode } from "react";
33
import { schnorr } from "@noble/curves/secp256k1.js";
44
import { bytesToHex } from "nostr-tools/utils";
5-
import { npubEncode } from "nostr-tools/nip19";
65
import "@testing-library/jest-dom/vitest";
76
import { stubAvatarBrowserApis } from "../agents/avatar-testing";
87
stubAvatarBrowserApis();
@@ -16,6 +15,7 @@ import {
1615
waitFor,
1716
within,
1817
} from "@testing-library/react";
18+
import userEvent from "@testing-library/user-event";
1919
import { PREVIEW_REST_MS } from "../../shared/design-system/ui/hoverIntent";
2020
import { messageCopyText } from "./message-copy";
2121
import { profileTarget, profileActivityViewTarget } from "../profiles/target";
@@ -2314,24 +2314,32 @@ it("dismisses an unsubmitted report when its retained row is suspended", async (
23142314
}
23152315
});
23162316

2317-
it("presents automation, links the owner and discloses the separate relay signer", async () => {
2318-
const ownerId = "ab".repeat(32),
2319-
signer = "cd".repeat(32);
2317+
function renderWorkflowMessage(open = vi.fn(() => true)) {
2318+
const ownerId = "ab".repeat(32);
2319+
renderMessage({
2320+
row: {
2321+
...row,
2322+
authorId: ownerId,
2323+
signerId: "cd".repeat(32),
2324+
workflowOwnerId: ownerId,
2325+
},
2326+
viewer: ownerId,
2327+
profile: { name: "Wes" },
2328+
participantProfiles: new Map([[ownerId, { name: "Wes" }]]),
2329+
onOpenLink: open,
2330+
canOpenLink: () => true,
2331+
});
2332+
return {
2333+
ownerId,
2334+
trigger: screen.getByRole("button", { name: "Workflow message details" }),
2335+
};
2336+
}
2337+
2338+
it("presents automation, links the owner and explains the message without keys", async () => {
23202339
const open = vi.fn(() => true);
2340+
const user = userEvent.setup();
23212341
try {
2322-
renderMessage({
2323-
row: {
2324-
...row,
2325-
authorId: ownerId,
2326-
signerId: signer,
2327-
workflowOwnerId: ownerId,
2328-
},
2329-
viewer: ownerId,
2330-
profile: { name: "Wes" },
2331-
participantProfiles: new Map([[ownerId, { name: "Wes" }]]),
2332-
onOpenLink: open,
2333-
canOpenLink: () => true,
2334-
});
2342+
const { ownerId, trigger } = renderWorkflowMessage(open);
23352343
// The automation label stays plain; only the owner opens a profile.
23362344
expect(
23372345
screen.getByText("Workflow").closest('button, [role="button"]'),
@@ -2345,23 +2353,59 @@ it("presents automation, links the owner and discloses the separate relay signer
23452353
expect(open).toHaveBeenCalledWith(profileTarget(ownerId), {
23462354
rootId: "root",
23472355
});
2348-
fireEvent.click(
2349-
screen.getByRole("button", { name: "Workflow message details" }),
2356+
trigger.focus();
2357+
await user.keyboard("{Enter}");
2358+
const card = await screen.findByRole("dialog", {
2359+
name: "Workflow message",
2360+
});
2361+
// The byline beside the trigger already names the owner; the card only
2362+
// says what a workflow message is, without keys or relay identity.
2363+
expect(card).toHaveAccessibleDescription(
2364+
"Sent automatically by a workflow. Its owner set it up but didn’t send this message personally.",
23502365
);
2351-
expect(
2352-
await screen.findByText(/the owner did not sign this message/),
2353-
).toBeTruthy();
2354-
expect(
2355-
screen.getByText("Signed by the relay").nextElementSibling,
2356-
).toHaveTextContent(npubEncode(signer));
2357-
expect(
2358-
screen.getByText("Owner public key").nextElementSibling,
2359-
).toHaveTextContent(npubEncode(ownerId));
2366+
expect(card).not.toHaveTextContent(/npub1|Wes/);
23602367
expect(
23612368
screen.queryByRole("button", { name: "View Relay profile" }),
23622369
).toBeNull();
2370+
await user.keyboard("{Escape}");
2371+
await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());
2372+
expect(trigger).toHaveFocus();
2373+
await user.click(trigger);
2374+
expect(
2375+
await screen.findByRole("dialog", { name: "Workflow message" }),
2376+
).toBeInTheDocument();
2377+
} finally {
2378+
cleanup();
2379+
}
2380+
});
2381+
2382+
it("opens workflow message details once the pointer rests, without a competing hint", async () => {
2383+
vi.useFakeTimers();
2384+
try {
2385+
const { trigger } = renderWorkflowMessage();
2386+
fireEvent.mouseEnter(trigger);
2387+
fireEvent.mouseMove(trigger);
2388+
await act(() => vi.advanceTimersByTimeAsync(PREVIEW_REST_MS - 1));
2389+
expect(screen.queryByRole("dialog")).toBeNull();
2390+
await act(() => vi.advanceTimersByTimeAsync(1));
2391+
const card = screen.getByRole("dialog", { name: "Workflow message" });
2392+
expect(screen.queryByRole("tooltip")).toBeNull();
2393+
// A hover heads-up leaves focus where the reader had it.
2394+
expect(card).not.toContainElement(document.activeElement as HTMLElement);
2395+
// Clicking the trigger that just opened it keeps it open.
2396+
fireEvent.click(trigger);
2397+
await act(() => vi.advanceTimersByTimeAsync(PREVIEW_REST_MS));
2398+
expect(
2399+
screen.getByRole("dialog", { name: "Workflow message" }),
2400+
).toBeInTheDocument();
2401+
fireEvent.keyDown(document.activeElement ?? document.body, {
2402+
key: "Escape",
2403+
});
2404+
await act(() => vi.advanceTimersByTimeAsync(PREVIEW_REST_MS));
2405+
expect(screen.queryByRole("dialog")).toBeNull();
23632406
} finally {
23642407
cleanup();
2408+
vi.useRealTimers();
23652409
}
23662410
});
23672411

‎src/features/messages/MessageRow.tsx‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,6 @@ function MessageRowContent({
954954
<WorkflowByline
955955
ownerId={row.workflowOwnerId}
956956
ownerName={workflowOwnerName}
957-
signer={row.signerId ?? row.authorId}
958957
canOpenLink={canOpenLink}
959958
onOpenLink={openLink}
960959
/>

‎src/features/messages/Messages.module.css‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2908,20 +2908,6 @@ html[data-keyboard-navigation] .rawDiff:focus-visible {
29082908
min-width: 0;
29092909
overflow-wrap: anywhere;
29102910
}
2911-
.workflowDetails {
2912-
margin-block: var(--space-3);
2913-
font-size: var(--text-body-sm);
2914-
line-height: var(--text-body-sm--line-height);
2915-
letter-spacing: var(--text-body-sm--letter-spacing);
2916-
}
2917-
.workflowDetails dt {
2918-
color: var(--text-subtle);
2919-
margin-top: var(--space-2);
2920-
}
2921-
.workflowDetails dd {
2922-
margin: 0;
2923-
overflow-wrap: anywhere;
2924-
}
29252911

29262912
/* Content hugs short messages while rich content can use the available width. */
29272913
.messageBubble {

‎src/features/messages/WorkflowByline.tsx‎

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { npubEncode } from "nostr-tools/nip19";
21
import { Button } from "../../shared/design-system/ui/Button";
32
import { IconButton } from "../../shared/design-system/ui/IconButton";
43
import { InfoIcon } from "../../shared/design-system/icons";
@@ -15,13 +14,11 @@ import styles from "./Messages.module.css";
1514
export function WorkflowByline({
1615
ownerId,
1716
ownerName,
18-
signer,
1917
canOpenLink,
2018
onOpenLink,
2119
}: {
2220
ownerId: string;
2321
ownerName: string;
24-
signer: string;
2522
canOpenLink?: ((url: string) => boolean) | undefined;
2623
onOpenLink(url: string): boolean;
2724
}) {
@@ -46,6 +43,7 @@ export function WorkflowByline({
4643
</span>
4744
<PopoverRoot>
4845
<PopoverTrigger
46+
openOnHover="preview"
4947
render={
5048
<IconButton
5149
size="xs"
@@ -58,20 +56,9 @@ export function WorkflowByline({
5856
<PopoverPopup size="compact">
5957
<PopoverTitle>Workflow message</PopoverTitle>
6058
<PopoverDescription>
61-
Sent automatically. This community’s relay attributes the workflow
62-
to this owner; the owner did not sign this message.
59+
Sent automatically by a workflow. Its owner set it up but didn’t
60+
send this message personally.
6361
</PopoverDescription>
64-
<dl className={styles.workflowDetails}>
65-
<dt>Workflow owner</dt>
66-
<dd>{ownerName}</dd>
67-
<dt>Owner public key</dt>
68-
<dd>{npubEncode(ownerId)}</dd>
69-
<dt>Signed by the relay</dt>
70-
<dd>{npubEncode(signer)}</dd>
71-
</dl>
72-
<p className="text-body-sm text-tertiary">
73-
Workflow and run details are not included in this message.
74-
</p>
7562
</PopoverPopup>
7663
</PopoverRoot>
7764
</span>

‎tests/fixtures/message-gallery/examples.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ export const groups: Group[] = [
338338
id: "workflow-owner",
339339
title: "Automated message",
340340
description:
341-
"Automation leads; owner navigation is labelled. Open the information icon to inspect the separate owner and relay keys.",
341+
"Automation leads; owner navigation is labelled. Rest on or open the information icon to read that the owner didn’t send it personally.",
342342
rows: foldMessages(
343343
"studio",
344344
workflowRelay.pubkey,

0 commit comments

Comments
 (0)