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 @@ -229,7 +229,7 @@ test("autocomplete helper extraction preserves safe filtering and labels", () =>
);
});

test("isAgentIdentityInAllowedList: keeps people and only explicitly allowed agent identities", () => {
test("isAgentIdentityInAllowedList: keeps people, channel members, and explicitly allowed agents", () => {
const allowedAgentPubkeys = new Set([PUB_A]);

assert.equal(
Expand All @@ -253,6 +253,13 @@ test("isAgentIdentityInAllowedList: keeps people and only explicitly allowed age
),
false,
);
assert.equal(
isAgentIdentityInAllowedList(
{ isAgent: true, isMember: true, pubkey: PUB_B },
allowedAgentPubkeys,
),
true,
);
});

test("shouldHideAgentFromMentions: never hides non-agents", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@ export function getMentionableAgentPubkeys({
}

export function isAgentIdentityInAllowedList(
candidate: { isAgent?: boolean; pubkey: string },
candidate: { isAgent?: boolean; isMember?: boolean; pubkey: string },
allowedAgentPubkeys: ReadonlySet<string>,
) {
return (
candidate.isAgent !== true ||
candidate.isMember === true ||
allowedAgentPubkeys.has(normalizePubkey(candidate.pubkey))
);
}
Expand Down