Skip to content
Merged
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 @@ -142,17 +142,18 @@ it.each(["jeff", "kameron"] as const)(
</AppAtomRegistryProvider>,
);
const mine = screen.getByRole("region", { name: "My Bots" });
const company = screen.getByRole("region", { name: "Shared Bots" });
const company = screen.getByRole("region", { name: "Closura" });
const jeff = owner === "jeff";
// Asymmetric: Jeff never lists Kameron's private bots, while Kameron keeps Jeff's visible.
// Asymmetric: Jeff never lists Kameron's private bots, while Kameron sees Jeff's under Others.
for (const name of jeff ? ["CoS (Jeff)", "Personal Finance"] : ["CoS"]) {
await expect.element(mine.getByText(name, { exact: true })).toBeVisible();
}
if (jeff) {
await expect.element(screen.getByText("CoS", { exact: true })).not.toBeInTheDocument();
} else {
const others = screen.getByRole("region", { name: "Others" });
for (const name of ["CoS (Jeff)", "Personal Finance"]) {
await expect.element(company.getByText(name, { exact: true })).toBeVisible();
await expect.element(others.getByText(name, { exact: true })).toBeVisible();
}
}
for (const name of shared) {
Expand Down
14 changes: 13 additions & 1 deletion apps/web/src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,7 @@ function partitionSidebarThreads(input: SidebarThreadPartitionInput) {
return {
botThreads: sortedBots,
myBotThreads: botGroups.mine,
otherBotThreads: botGroups.others,
sharedBotThreads: botGroups.shared,
pinnedThreads:
optimisticDrop?.section !== "pinned" || optimisticDrop.order === null
Expand Down Expand Up @@ -1511,6 +1512,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
workingShelfEnabled,
botThreads,
myBotThreads,
otherBotThreads,
sharedBotThreads,
pinnedThreads,
draggableThreadKeys,
Expand Down Expand Up @@ -3731,7 +3733,17 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
onContextMenu={handleThreadContextMenu}
/>
<SidebarBotsGroup
label={gt("Shared Bots")}
label={gt("Others")}
groupId="Others"
testId="sidebar-other-bots-group"
threads={otherBotThreads}
activeThreadKey={routeRowThreadKey}
onThreadClick={handleThreadClick}
onThreadActivate={navigateToThread}
onContextMenu={handleThreadContextMenu}
/>
<SidebarBotsGroup
label={gt("Closura")}
groupId="Shared Bots"
testId="sidebar-shared-bots-group"
threads={sharedBotThreads}
Expand Down
25 changes: 14 additions & 11 deletions apps/web/src/components/bots/botPresence.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,22 @@ describe("partitionBotGroups", () => {
id,
source: { inbox: { owner, audience } },
});
it("puts shared-inbox bots in their own group and leaves the rest as mine", () => {
it("puts company/shared/agent-only/open bots in Closura (shared) and personal bots in mine when viewer is unset", () => {
expect(
partitionBotGroups([thread("shared", "shared"), thread("jeff", "jeff"), thread("open")]),
partitionBotGroups([
thread("shared", "shared"),
thread("agents", "agent-only"),
thread("jeff", "jeff"),
thread("open"),
]),
).toEqual({
shared: [thread("shared", "shared")],
mine: [thread("jeff", "jeff"), thread("open")],
shared: [thread("shared", "shared"), thread("agents", "agent-only"), thread("open")],
mine: [thread("jeff", "jeff")],
others: [],
});
});

it("keeps Jeff's personal bots in Kameron's lists beside his own and shared ones", () => {
it("puts Kameron's own in My Bots, Jeff's personal bots in Others, and company bots in Closura", () => {
const threads = [
thread("shared", "shared"),
thread("mine", "kameron"),
Expand All @@ -127,12 +133,8 @@ describe("partitionBotGroups", () => {
];
expect(partitionBotGroups(threads, "kameron")).toEqual({
mine: [thread("mine", "kameron")],
shared: [
thread("shared", "shared"),
thread("other", "jeff"),
thread("agents", "agent-only"),
thread("open"),
],
others: [thread("other", "jeff")],
shared: [thread("shared", "shared"), thread("agents", "agent-only"), thread("open")],
});
});

Expand All @@ -150,6 +152,7 @@ describe("partitionBotGroups", () => {
];
expect(partitionBotGroups(threads, "jeff")).toEqual({
mine: [thread("cos-jeff", "jeff"), owned("kameron-jeff", "kameron", "jeff")],
others: [],
shared: [
thread("shared", "shared"),
thread("agents", "agent-only"),
Expand Down
30 changes: 18 additions & 12 deletions apps/web/src/components/bots/botPresence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,25 +93,31 @@ type BotInbox = {
};

/**
* The two bot groups. Shared audience is Shared Bots. With a viewer, an Agents or missing inbox
* and the other founder's bots are Shared Bots too; the viewer's own stay in My Bots. Jeff never
* lists Kameron's private bots (`isHiddenFromFounder`), while Kameron lists Jeff's.
* The three bot groups:
* - `mine` ("My Bots"): the viewer's own personal bots (`audience === viewer`, or all personal bots when no viewer is set).
* - `others` ("Others"): the other founder's personal bots (shown for Kameron; Jeff never lists Kameron's private bots via `isHiddenFromFounder`).
* - `shared` ("Closura"): all company bots (`audience === "shared"`, `"agent-only"`, or missing).
*/
export function partitionBotGroups<
T extends { readonly source: { readonly inbox?: BotInbox | null } },
>(threads: readonly T[], viewer?: Founder): { readonly mine: T[]; readonly shared: T[] } {
>(
threads: readonly T[],
viewer?: Founder,
): { readonly mine: T[]; readonly others: T[]; readonly shared: T[] } {
const mine: T[] = [];
const others: T[] = [];
const shared: T[] = [];
for (const thread of threads) {
if (isHiddenFromFounder(thread.source.inbox, viewer)) continue;
const audience = thread.source.inbox?.audience;
const sharedWithBoth =
isSharedBotThread(thread) ||
(viewer !== undefined &&
(audience === "agent-only" ||
audience == null ||
((audience === "kameron" || audience === "jeff") && audience !== viewer)));
(sharedWithBoth ? shared : mine).push(thread);
const isPersonal = audience === "kameron" || audience === "jeff";
if (!isPersonal || isSharedBotThread(thread)) {
shared.push(thread);
} else if (viewer !== undefined && audience !== viewer) {
others.push(thread);
} else {
mine.push(thread);
}
}
return { mine, shared };
return { mine, others, shared };
}
4 changes: 2 additions & 2 deletions apps/web/src/i18n/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -2597,7 +2597,8 @@
"e3ed00af71363d39": "Noch keine Threads in diesen Projekten",
"981053bcf95b3d3f": "Noch keine Threads in {project}",
"d978598ec5ca3ac4": "My Bots",
"007c13b6a386b5be": "Shared Bots",
"87d943aa8f91b9a2": "Andere",
"8260a90361496410": "Closura",
"151767f20fa67c48": "Angeheftet",
"db8f17154d4f0cfa": "Aktiv",
"9578dc3e84f82081": "In Arbeit",
Expand Down Expand Up @@ -7432,7 +7433,6 @@
"c3d96c942dc3125d": "Der Link konnte nicht kopiert werden",
"05cf59d40e17ba63": "Review angefordert",
"e369d7ce5ff36689": "Verfasst",
"87d943aa8f91b9a2": "Andere",
"e8c320d314d151e9": "Im Review",
"8c7976cc624d8d4f": "Verfasst",
"7ab39987db037952": "Merge-Bereitschaft",
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/i18n/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2597,7 +2597,8 @@
"e3ed00af71363d39": "No threads in these projects yet",
"981053bcf95b3d3f": "No threads in {project} yet",
"d978598ec5ca3ac4": "My Bots",
"007c13b6a386b5be": "Shared Bots",
"87d943aa8f91b9a2": "Others",
"8260a90361496410": "Closura",
"151767f20fa67c48": "Pinned",
"db8f17154d4f0cfa": "Active",
"9578dc3e84f82081": "Working",
Expand Down Expand Up @@ -7440,7 +7441,6 @@
"c3d96c942dc3125d": "Could not copy the link",
"05cf59d40e17ba63": "Review requested",
"e369d7ce5ff36689": "Authored",
"87d943aa8f91b9a2": "Others",
"e8c320d314d151e9": "Reviewing",
"8c7976cc624d8d4f": "Authored",
"7ab39987db037952": "Merge readiness",
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/i18n/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -2597,7 +2597,8 @@
"e3ed00af71363d39": "Aún no hay hilos en estos proyectos",
"981053bcf95b3d3f": "Aún no hay hilos en {project}",
"d978598ec5ca3ac4": "My Bots",
"007c13b6a386b5be": "Shared Bots",
"87d943aa8f91b9a2": "Otras",
"8260a90361496410": "Closura",
"151767f20fa67c48": "Fijados",
"db8f17154d4f0cfa": "Activos",
"9578dc3e84f82081": "En curso",
Expand Down Expand Up @@ -7433,7 +7434,6 @@
"c3d96c942dc3125d": "No se pudo copiar el enlace",
"05cf59d40e17ba63": "Revisión solicitada",
"e369d7ce5ff36689": "Creadas por mí",
"87d943aa8f91b9a2": "Otras",
"e8c320d314d151e9": "Revisando",
"8c7976cc624d8d4f": "Creadas por mí",
"7ab39987db037952": "Lista para fusionar",
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/i18n/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2597,7 +2597,8 @@
"e3ed00af71363d39": "Pas encore de fil dans ces projets",
"981053bcf95b3d3f": "Pas encore de fil dans {project}",
"d978598ec5ca3ac4": "My Bots",
"007c13b6a386b5be": "Shared Bots",
"87d943aa8f91b9a2": "Autres",
"8260a90361496410": "Closura",
"151767f20fa67c48": "Épinglés",
"db8f17154d4f0cfa": "Actifs",
"9578dc3e84f82081": "En cours",
Expand Down Expand Up @@ -7434,7 +7435,6 @@
"c3d96c942dc3125d": "Impossible de copier le lien",
"05cf59d40e17ba63": "Revue demandée",
"e369d7ce5ff36689": "Créées par moi",
"87d943aa8f91b9a2": "Autres",
"e8c320d314d151e9": "En revue",
"8c7976cc624d8d4f": "Créées par moi",
"7ab39987db037952": "Prête à fusionner",
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/i18n/translations/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -2595,7 +2595,8 @@
"e3ed00af71363d39": "これらのプロジェクトにはまだスレッドがありません",
"981053bcf95b3d3f": "{project} にはまだスレッドがありません",
"d978598ec5ca3ac4": "My Bots",
"007c13b6a386b5be": "Shared Bots",
"87d943aa8f91b9a2": "その他",
"8260a90361496410": "Closura",
"151767f20fa67c48": "ピン留め済み",
"db8f17154d4f0cfa": "アクティブ",
"9578dc3e84f82081": "作業中",
Expand Down Expand Up @@ -7399,7 +7400,6 @@
"c3d96c942dc3125d": "リンクをコピーできませんでした",
"05cf59d40e17ba63": "レビューを依頼されたもの",
"e369d7ce5ff36689": "作成したもの",
"87d943aa8f91b9a2": "その他",
"e8c320d314d151e9": "レビュー中",
"8c7976cc624d8d4f": "作成したもの",
"7ab39987db037952": "マージの準備状況",
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/i18n/translations/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -2596,7 +2596,8 @@
"e3ed00af71363d39": "이 프로젝트들에 아직 스레드가 없습니다",
"981053bcf95b3d3f": "{project}에 아직 스레드가 없습니다",
"d978598ec5ca3ac4": "My Bots",
"007c13b6a386b5be": "Shared Bots",
"87d943aa8f91b9a2": "기타",
"8260a90361496410": "Closura",
"151767f20fa67c48": "고정됨",
"db8f17154d4f0cfa": "활성",
"9578dc3e84f82081": "작업 중",
Expand Down Expand Up @@ -7402,7 +7403,6 @@
"c3d96c942dc3125d": "링크를 복사할 수 없습니다",
"05cf59d40e17ba63": "검토 요청됨",
"e369d7ce5ff36689": "작성함",
"87d943aa8f91b9a2": "기타",
"e8c320d314d151e9": "검토 중",
"8c7976cc624d8d4f": "작성함",
"7ab39987db037952": "병합 준비 상태",
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/i18n/translations/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -2597,7 +2597,8 @@
"e3ed00af71363d39": "Ainda não há threads nestes projetos",
"981053bcf95b3d3f": "Ainda não há threads em {project}",
"d978598ec5ca3ac4": "My Bots",
"007c13b6a386b5be": "Shared Bots",
"87d943aa8f91b9a2": "Outros",
"8260a90361496410": "Closura",
"151767f20fa67c48": "Fixadas",
"db8f17154d4f0cfa": "Ativas",
"9578dc3e84f82081": "Trabalhando",
Expand Down Expand Up @@ -7433,7 +7434,6 @@
"c3d96c942dc3125d": "Não foi possível copiar o link",
"05cf59d40e17ba63": "Revisão solicitada",
"e369d7ce5ff36689": "De sua autoria",
"87d943aa8f91b9a2": "Outros",
"e8c320d314d151e9": "Revisando",
"8c7976cc624d8d4f": "De sua autoria",
"7ab39987db037952": "Pronto para merge",
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/i18n/translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -2597,7 +2597,8 @@
"e3ed00af71363d39": "В этих проектах пока нет тредов",
"981053bcf95b3d3f": "В {project} пока нет тредов",
"d978598ec5ca3ac4": "My Bots",
"007c13b6a386b5be": "Shared Bots",
"87d943aa8f91b9a2": "Другие",
"8260a90361496410": "Closura",
"151767f20fa67c48": "Закреплённые",
"db8f17154d4f0cfa": "Активные",
"9578dc3e84f82081": "В работе",
Expand Down Expand Up @@ -7433,7 +7434,6 @@
"c3d96c942dc3125d": "Не удалось скопировать ссылку",
"05cf59d40e17ba63": "Запрошено ревью",
"e369d7ce5ff36689": "Мои",
"87d943aa8f91b9a2": "Другие",
"e8c320d314d151e9": "На ревью",
"8c7976cc624d8d4f": "Мои",
"7ab39987db037952": "Готовность к слиянию",
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/i18n/translations/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -2597,7 +2597,8 @@
"e3ed00af71363d39": "Inga trådar i de här projekten än",
"981053bcf95b3d3f": "Inga trådar i {project} än",
"d978598ec5ca3ac4": "My Bots",
"007c13b6a386b5be": "Shared Bots",
"87d943aa8f91b9a2": "Andra",
"8260a90361496410": "Closura",
"151767f20fa67c48": "Fästa",
"db8f17154d4f0cfa": "Aktiva",
"9578dc3e84f82081": "Arbetar",
Expand Down Expand Up @@ -7439,7 +7440,6 @@
"c3d96c942dc3125d": "Kunde inte kopiera länken",
"05cf59d40e17ba63": "Granskning begärd",
"e369d7ce5ff36689": "Skapade av mig",
"87d943aa8f91b9a2": "Andra",
"e8c320d314d151e9": "Granskar",
"8c7976cc624d8d4f": "Skapade av mig",
"7ab39987db037952": "Redo för merge",
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/i18n/translations/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -2601,7 +2601,8 @@
"e3ed00af71363d39": "这些项目中暂无会话",
"981053bcf95b3d3f": "{project} 中暂无会话",
"d978598ec5ca3ac4": "My Bots",
"007c13b6a386b5be": "Shared Bots",
"87d943aa8f91b9a2": "其他",
"8260a90361496410": "Closura",
"151767f20fa67c48": "已置顶",
"db8f17154d4f0cfa": "活跃",
"9578dc3e84f82081": "运行中",
Expand Down Expand Up @@ -7447,7 +7448,6 @@
"c3d96c942dc3125d": "无法复制链接",
"05cf59d40e17ba63": "已请求我审查",
"e369d7ce5ff36689": "我创建的",
"87d943aa8f91b9a2": "其他",
"e8c320d314d151e9": "我审查的",
"8c7976cc624d8d4f": "我创建的",
"7ab39987db037952": "合并就绪状态",
Expand Down
Loading