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
2 changes: 1 addition & 1 deletion desktop/src/features/messages/ui/MessageComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ function MessageComposerImpl({
restoreAddressedAgentMentionsRef.current(pubkeys),
onAddressedAgentsSendFailed: addressPulse.shakeMany,
onAddressedAgentsSendSucceeded: (pubkeys, newlyPinnedPubkeys) => {
if (newlyPinnedPubkeys.length === 0) return;
if (!keepMentionedAgentsPinned || newlyPinnedPubkeys.length === 0) return;
const sentChannelId = channelId;
if (restoreAddressedAgentMentionsFrameRef.current !== null) {
cancelAnimationFrame(restoreAddressedAgentMentionsFrameRef.current);
Expand Down
36 changes: 35 additions & 1 deletion desktop/tests/e2e/persistent-agent-audience.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,40 @@ test("Tab inserts a one-time agent mention by default", async ({ page }) => {
).toHaveCount(0);
});

test("disabling automatic mentions leaves the composer empty after send", async ({
page,
}) => {
await keepMentionedAgentsPinned(page);
await installAudienceFixtures(page);
await openGeneral(page);

const composer = channelComposer(page);
const input = composer.getByTestId("message-input");
await composer.getByTestId("message-insert-mention").click();
await composer.getByTestId("mention-options-trigger").click();
const preference = composer.getByTestId("mention-keep-agents-pinned-toggle");
await expect(preference).toHaveAttribute("data-state", "checked");
await preference.click();
await expect(preference).toHaveAttribute("data-state", "unchecked");
await input.press("Escape");

await input.fill("@Mor");
await expect(composer.getByTestId("mention-autocomplete")).toBeVisible();
await input.press("Tab");
await input.type("test");
await expect(input).toHaveText("@Morgarita test");
await input.press("Enter");

await expect(input).toHaveText("");
await expect(input.locator(".agent-mention-highlight")).toHaveCount(0);
await expect(
composer.getByTestId(`composer-address-lock-${AGENT_A}`),
).toHaveCount(0);
await expect
.poll(() => readOutgoingMentionPubkeys(page, "@Morgarita test"))
.toContain(AGENT_A);
});

test("primary+Shift+M addresses the default agent, then selects the highlighted agent", async ({
page,
}) => {
Expand Down Expand Up @@ -457,7 +491,7 @@ test("the mention button opens settings and can undo an address", async ({

await input.type("later");
await input.press("Enter");
await expect(input).toHaveText("@Morgarita ");
await expect(input).toHaveText("");
await expect
.poll(() => readOutgoingMentionPubkeys(page, "@Morgarita later"))
.toContain(AGENT_A);
Expand Down
Loading