Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Keep a teammate's longer name whole when it starts with @all
bsisducka6d353f669d2
diff --git a/src/lib/mentions.test.ts b/src/lib/mentions.test.tsindex 42fc385861..ccbff0a7a1 100644--- a/src/lib/mentions.test.ts+++ b/src/lib/mentions.test.ts@@ -111,6 +111,12 @@ describe("a teammate's tag in display ranges", () => {expect(mentionRanges(text, list).map(({ person }) => person ?? false)).toEqual([true]);}});+ it("keeps a teammate's longer name whole when it starts with @all", () => {+ const list = [...peers, { name: "All Hands", person: true as const }];+ const tags = (text: string) => mentionRanges(text, list, true).map(({ start, end, person }) => [text.slice(start, end), person ?? false]);+ expect(tags("@All Hands please")).toEqual([["@All Hands", true]]);+ expect(tags("@all please")).toEqual([["@all", false]]);+ });it("does not let a teammate's name take the viewer's own tag away", () => {expect(mentionRanges("@Sam", [{ name: "Sam", person: true }], false, { profileName: "Sam" })).toEqual([{ start: 0, end: 4, you: true }]);});diff --git a/src/lib/mentions.ts b/src/lib/mentions.tsindex 0d42252588..236f0ed729 100644--- a/src/lib/mentions.ts+++ b/src/lib/mentions.ts@@ -69,7 +69,7 @@ export function mentionRanges(text: string, peers: readonly MentionPeer[], everyconst rest = text.slice(at + 1);const peer = candidates.find(({ name }) => rest.slice(0, name.length).toLowerCase() === name.toLowerCase()&& !isMentionNameContinuation(rest.slice(name.length)));- const all = everyone ? everyoneTagAt(rest, botNames) : undefined;+ const all = everyone ? everyoneTagAt(rest, candidates.map(({ name }) => name)) : undefined;const you = all === undefined && personNames.length ? personTagAt(rest, personNames, botNames) : undefined;if (you !== undefined) {ranges.push({ start: at, end: at + you + 1, you: true });