Keep only the bot cookie for the last visited bot
CI / check (push) Canceled after 0s

A workspace conversation is never remembered, so /admin/bots always
reopens the bot's own chat.
This commit is contained in:
2026-10-22 13:39:36 +01:00
parent 133e6b87c9
commit 63a93a4262
13 changed files with 48 additions and 147 deletions
+3 -4
View File
@@ -7,14 +7,13 @@ type Params = {
};
/**
* The conversation this browser was last in, from the last-visited cookies
* (see `lastVisitedBotCookies`). Null when it has none, or when they don't
* name a conversation. Whether the user still reaches it is the caller's
* The bot this browser was last in, from the last-visited cookie (see
* `lastVisitedBotCookies`). Null when it has none, or when it doesn't name
* a bot. Whether the user still reaches that bot's own chat is the caller's
* check: a stale grant must fall back, never redirect.
*/
export default function readLastVisitedBot({ req }: Params): LastVisitedBot | null {
return parseLastVisitedBot({
bot_id: getCookie(req, AppData["LastVisitedBotCookieName"]),
workspace_id: getCookie(req, AppData["LastVisitedWorkspaceCookieName"]),
});
}