Skip to content

Open-source AI browser agent for Chrome and Firefox (monorepo) 🧠

fix: support transcript-bound Discord threads

Emre Sokullud5c583935c38
diff --git a/src/chrome/src/content/chat-observation.js b/src/chrome/src/content/chat-observation.js
index cd49eeeb4..0fb224bf1 100644
--- a/src/chrome/src/content/chat-observation.js
+++ b/src/chrome/src/content/chat-observation.js
@@ -181,7 +181,7 @@
return transcript && (directMessageRoute
? !selectedDmRouteMismatch
&& (transcriptRows.length > 0 ? transcriptMatchesRoute : channelLink)
- : channelLink && (transcriptRows.length === 0 || transcriptMatchesRoute))
+ : (transcriptRows.length > 0 ? transcriptMatchesRoute : channelLink))
? {
root, transcript, name, channelId,
isDirectMessage: !!directMessageRoute,
diff --git a/src/firefox/src/content/chat-observation.js b/src/firefox/src/content/chat-observation.js
index cd49eeeb4..0fb224bf1 100644
--- a/src/firefox/src/content/chat-observation.js
+++ b/src/firefox/src/content/chat-observation.js
@@ -181,7 +181,7 @@
return transcript && (directMessageRoute
? !selectedDmRouteMismatch
&& (transcriptRows.length > 0 ? transcriptMatchesRoute : channelLink)
- : channelLink && (transcriptRows.length === 0 || transcriptMatchesRoute))
+ : (transcriptRows.length > 0 ? transcriptMatchesRoute : channelLink))
? {
root, transcript, name, channelId,
isDirectMessage: !!directMessageRoute,
diff --git a/test/discord-guard.mjs b/test/discord-guard.mjs
index 365985ef4..9cfdd1ffc 100644
--- a/test/discord-guard.mjs
+++ b/test/discord-guard.mjs
@@ -321,6 +321,9 @@ for (const [kind, engine, AgentClass, policy] of [
assert.equal(localized.threadKey,result.threadKey);
assert.deepEqual(localized.messages,result.messages);
+ await page.locator('#channel').evaluate(el=>el.removeAttribute('aria-current'));
+ assert.equal((await observe()).success,true,'a matching populated guild transcript can bind without a selected rail link');
+ await page.locator('#channel').evaluate(el=>el.setAttribute('aria-current','page'));
await page.locator('nav').evaluate(el=>el.insertAdjacentHTML('beforeend',
'<a id="channel-b" href="/channels/123/789" aria-current="page">second channel</a>'));
await page.evaluate(()=>history.replaceState(null,'','/channels/123/789'));