cheogram-www

created pr with cheogram-www/multi-dm.1 on 2026-11-10T19:08:58Z · by 9e834e0d
changed pr name to New UI for starting chats with multiDM support on 2026-11-10T19:32:17Z · by 9e834e0d
added cheogram-www/multi-dm.2 on 2026-11-10T19:32:24Z · by 9e834e0d
1: 8f55142 < -: ------- Add UI to create private channel
2: ea160a8 ! 1: e758cfd New UI for starting chats
3: faa9d23 = 2: eb5c50d Special case for group texts
4: 0d9f850 = 3: 2217816 Only enable non-group-text multiDM experimentally
cmds
checkout latest patchset:
ssh pr.pico.sh pull cheogram-www:multi-dm | git am -3
checkout specific patchset revision:
ssh pr.pico.sh pull cheogram-www:multi-dm [rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh cheogram-www:multi-dm
add comment to patch request:
ssh pr.pico.sh comment cheogram-www:multi-dm "lgtm!"
+18 -2 src/components/NewChatDialog.test.tsx #
......@@ -8,10 +8,11 @@ import {
88 screen,
99 waitFor,
1010 } from "@testing-library/react";
11-import { afterEach, describe, expect, it, vi } from "vitest";
11+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
1212 import { mock } from "vitest-mock-extended";
1313 import { NewChatDialog } from "./NewChatDialog";
1414
15+beforeEach(() => localStorage.clear());
1516 afterEach(cleanup);
1617
1718 const availableChat = (
......@@ -108,7 +109,8 @@ describe("NewChatDialog", () => {
108109 expect(startChat).toHaveBeenCalledWith(alice);
109110 });
110111
111- it("starts a multiDM when more than one result is selected", async () => {
112+ it("starts a multiDM when EXPERIMENTAL is set", async () => {
113+ localStorage.setItem("EXPERIMENTAL", "1");
112114 const alice = availableChat("alice@example.com", "Alice");
113115 const bob = availableChat("bob@example.com", "Bob");
114116 const { startMultiChat, onStarted, multiChat } = setup([alice, bob]);
......@@ -121,6 +123,20 @@ describe("NewChatDialog", () => {
121123 expect(startMultiChat).toHaveBeenCalledWith([alice, bob]);
122124 });
123125
126+ it("replaces non-Cheogram selections when EXPERIMENTAL is not set", async () => {
127+ const alice = availableChat("alice@example.com", "Alice");
128+ const bob = availableChat("bob@example.com", "Bob");
129+ const { startChat, startMultiChat, onStarted, chat } = setup([alice, bob]);
130+
131+ fireEvent.click(await search("example.com", "Alice"));
132+ fireEvent.click(screen.getByText("Bob"));
133+ fireEvent.click(screen.getByRole("button", { name: "Start Chat" }));
134+
135+ await waitFor(() => expect(onStarted).toHaveBeenCalledWith(chat));
136+ expect(startChat).toHaveBeenCalledWith(bob);
137+ expect(startMultiChat).not.toHaveBeenCalled();
138+ });
139+
124140 it("does not offer the current account as a counterpart", async () => {
125141 const me = availableChat("me@example.com", "Me");
126142 const alice = availableChat("alice@example.com", "Alice");
+7 -3 src/components/NewChatDialog.tsx #
......@@ -116,10 +116,14 @@ export const NewChatDialog = ({
116116 return existing.filter((c) => c.chatId !== availableChat.chatId);
117117 }
118118
119- // A multiDM cannot include a channel, and Cheogram contacts can only be
120- // grouped with other Cheogram contacts, so an incompatible selection
121- // replaces any other selections.
119+ // MultiDMs are experimental, and cannot include a channel. Cheogram
120+ // contacts can only be grouped with other Cheogram contacts, so an
121+ // incompatible selection replaces any other selections.
122+ const multiDMEnabled =
123+ isCheogramChat(availableChat) ||
124+ localStorage.getItem("EXPERIMENTAL") !== null;
122125 if (
126+ !multiDMEnabled ||
123127 availableChat.isChannel() ||
124128 existing.some((c) => c.isChannel()) ||
125129 (existing.length > 0 &&
Back to top