Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ export function getMentionableAgentPubkeys({
}

export function isAgentIdentityInManagedList(
candidate: { isAgent?: boolean; pubkey: string },
candidate: { isAgent?: boolean; isMember?: boolean; pubkey: string },
managedAgentPubkeys: ReadonlySet<string>,
) {
return (
candidate.isAgent !== true ||
candidate.isMember === true ||
managedAgentPubkeys.has(normalizePubkey(candidate.pubkey))
);
}
Expand Down
15 changes: 15 additions & 0 deletions desktop/tests/e2e/mentions.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { expect, test } from "@playwright/test";

import { isAgentIdentityInManagedList } from "../../src/features/agents/lib/agentAutocompleteEligibility";

import {
installMockBridge,
openChannelBrowser,
Expand Down Expand Up @@ -36,6 +38,19 @@ const DM_THREAD_AGENT_MENTION_ERROR_TEXT =
const DM_THREAD_MEMBERS_LOADING_ERROR_TEXT =
"Checking conversation members. Try again in a moment.";

test("in-channel relay agents pass autocomplete eligibility without a local management record", () => {
expect(
isAgentIdentityInManagedList(
{
pubkey: ALLOWLIST_RELAY_AGENT_PUBKEY,
isAgent: true,
isMember: true,
},
new Set(),
),
).toBe(true);
});

/** Locator scoped to the mention autocomplete dropdown inside the composer. */
function autocomplete(page: import("@playwright/test").Page) {
return page
Expand Down