Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
✨ Keep one conferencing account per provider (#3384)
Luke Vella4a8002a9af45
diff --git a/apps/docs/images/integrations/google-meet/connect-account.png b/apps/docs/images/integrations/google-meet/connect-account.pngindex 0e48ab90e..654f6e61a 100644Binary files a/apps/docs/images/integrations/google-meet/connect-account.png and b/apps/docs/images/integrations/google-meet/connect-account.png differdiff --git a/apps/docs/images/integrations/google-meet/connected-account.png b/apps/docs/images/integrations/google-meet/connected-account.pngindex 16d1f1b3a..496616887 100644Binary files a/apps/docs/images/integrations/google-meet/connected-account.png and b/apps/docs/images/integrations/google-meet/connected-account.png differdiff --git a/apps/docs/images/integrations/google-meet/disconnect-menu.png b/apps/docs/images/integrations/google-meet/disconnect-menu.pngindex 4c83c3dc5..c66c42e41 100644Binary files a/apps/docs/images/integrations/google-meet/disconnect-menu.png and b/apps/docs/images/integrations/google-meet/disconnect-menu.png differdiff --git a/apps/docs/images/integrations/zoom/connect-account.png b/apps/docs/images/integrations/zoom/connect-account.pngindex 19003f325..fbabb281f 100644Binary files a/apps/docs/images/integrations/zoom/connect-account.png and b/apps/docs/images/integrations/zoom/connect-account.png differdiff --git a/apps/docs/images/integrations/zoom/connected-account.png b/apps/docs/images/integrations/zoom/connected-account.pngindex 616b8caf7..ac8d312a0 100644Binary files a/apps/docs/images/integrations/zoom/connected-account.png and b/apps/docs/images/integrations/zoom/connected-account.png differdiff --git a/apps/docs/images/integrations/zoom/disconnect-menu.png b/apps/docs/images/integrations/zoom/disconnect-menu.pngindex 9eab696cc..9cb4e38a3 100644Binary files a/apps/docs/images/integrations/zoom/disconnect-menu.png and b/apps/docs/images/integrations/zoom/disconnect-menu.png differdiff --git a/apps/docs/integrations/google-meet.mdx b/apps/docs/integrations/google-meet.mdxindex dd403abca..c3b489f14 100644--- a/apps/docs/integrations/google-meet.mdx+++ b/apps/docs/integrations/google-meet.mdx@@ -27,22 +27,22 @@ The meeting space belongs to the Google account you connected, so it follows thaIn Rallly, open **Settings** from the sidebar and choose **Conferencing**.</Step><Step title="Connect your account">- Click **Connect account** and choose **Google Meet**. You are sent to Google to choose an account and approve the connection.+ Next to **Google Meet**, click **Connect**. You are sent to Google to choose an account and approve the connection.<Frame>- <img src="/images/integrations/google-meet/connect-account.png" alt="The Conferencing settings page with the Connect account menu open, showing Zoom and Google Meet" />+ <img src="/images/integrations/google-meet/connect-account.png" alt="The Conferencing settings page listing Zoom and Google Meet, each with a Connect button" /></Frame></Step><Step title="Approve the permissions">- Google shows what Rallly is asking for (listed under [Permissions](#permissions)). Make sure the Google Meet permission is selected, then click **Continue**. You are returned to Rallly and your Google account appears in the list of connected accounts as Google Meet.+ Google shows what Rallly is asking for (listed under [Permissions](#permissions)). Make sure the Google Meet permission is selected, then click **Continue**. You are returned to Rallly, where the email address of your Google account appears next to Google Meet.<Frame>- <img src="/images/integrations/google-meet/connected-account.png" alt="The Conferencing settings page listing a connected Google Meet account" />+ <img src="/images/integrations/google-meet/connected-account.png" alt="The Conferencing settings page showing the connected account's email address next to Google Meet" /></Frame></Step></Steps>-Connect one Google account for Google Meet. If you connect more than one, Rallly uses the one you connected first. To switch to a different Google account, disconnect the current one, then connect the new one.+You can connect one Google account for Google Meet. To switch to a different Google account, disconnect the current one, then connect the new one.### If Google Calendar is already connected@@ -118,13 +118,13 @@ Rallly does not store the content of any meeting.### From Rallly1. Open **Settings**, then **Conferencing**.-2. On your Google Meet account, click the **More options** button and choose **Disconnect**.+2. Next to **Google Meet**, click the **More options** button and choose **Disconnect**.<Frame>- <img src="/images/integrations/google-meet/disconnect-menu.png" alt="The connected Google Meet account with its menu open, showing Disconnect" />+ <img src="/images/integrations/google-meet/disconnect-menu.png" alt="The connected Google Meet row with its menu open, showing Disconnect" /></Frame>-The connection is removed immediately and Rallly stops creating Google Meet links with that Google account. If another Google account is still connected for Google Meet, Rallly uses that one instead; disconnect every Google Meet connection to stop Rallly creating links altogether. What happens to the tokens depends on whether the same Google account is connected for Google Calendar:+The connection is removed immediately and Rallly stops creating Google Meet links for you. What happens to the tokens depends on whether the same Google account is connected for Google Calendar:- If it is not, Rallly deletes the tokens it stored for that Google account.- If it is, Rallly keeps the tokens, because your calendar connection still needs them.diff --git a/apps/docs/integrations/zoom.mdx b/apps/docs/integrations/zoom.mdxindex bad3ad331..9235e41a4 100644--- a/apps/docs/integrations/zoom.mdx+++ b/apps/docs/integrations/zoom.mdx@@ -27,22 +27,22 @@ The meeting is created on the Zoom account you connected, so it follows that accIn Rallly, open **Settings** from the sidebar and choose **Conferencing**.</Step><Step title="Connect your account">- Click **Connect account** and choose **Zoom**. You are sent to Zoom to sign in and approve the connection.+ Next to **Zoom**, click **Connect**. You are sent to Zoom to sign in and approve the connection.<Frame>- <img src="/images/integrations/zoom/connect-account.png" alt="The Conferencing settings page with the Connect account menu open, showing Zoom and Google Meet" />+ <img src="/images/integrations/zoom/connect-account.png" alt="The Conferencing settings page listing Zoom and Google Meet, each with a Connect button" /></Frame></Step><Step title="Approve the permissions">- Zoom shows what Rallly is asking for (listed under [Permissions](#permissions)). Click **Allow**. You are returned to Rallly and your Zoom account appears in the list of connected accounts.+ Zoom shows what Rallly is asking for (listed under [Permissions](#permissions)). Click **Allow**. You are returned to Rallly, where the email address of your Zoom account appears next to Zoom.<Frame>- <img src="/images/integrations/zoom/connected-account.png" alt="The Conferencing settings page listing a connected Zoom account" />+ <img src="/images/integrations/zoom/connected-account.png" alt="The Conferencing settings page showing the connected account's email address next to Zoom" /></Frame></Step></Steps>-You can connect one Zoom account per Rallly account. To switch to a different Zoom account, remove the current one first.+You can connect one Zoom account per Rallly account. To switch to a different Zoom account, disconnect the current one, then connect the new one.## Using the integration@@ -115,10 +115,10 @@ Rallly does not store the content of any meeting.### From Rallly1. Open **Settings**, then **Conferencing**.-2. On your Zoom account, click the **More options** button and choose **Disconnect**.+2. Next to **Zoom**, click the **More options** button and choose **Disconnect**.<Frame>- <img src="/images/integrations/zoom/disconnect-menu.png" alt="The connected Zoom account with its menu open, showing Disconnect" />+ <img src="/images/integrations/zoom/disconnect-menu.png" alt="The connected Zoom row with its menu open, showing Disconnect" /></Frame>The connection is removed immediately: Rallly deletes the account details and tokens it stored, then asks Zoom to revoke its access. To confirm the access is gone, remove the app from Zoom as described below. Polls that already chose Zoom keep that choice but can no longer be finalized with a Zoom link until an account is connected again. Meetings Rallly already created stay in your Zoom account; delete them from Zoom if you no longer need them.diff --git a/apps/web/public/locales/en/app.json b/apps/web/public/locales/en/app.jsonindex 9940543c0..4f154f4a2 100644--- a/apps/web/public/locales/en/app.json+++ b/apps/web/public/locales/en/app.json@@ -179,7 +179,7 @@"configuredByEnvironmentVariable": "This setting has been configured by environment variable.","confirm": "Confirm","confirmSpaceName": "Please type the space name to confirm:",- "connectAccount": "Connect account",+ "connect": "Connect","connectCalendar": "Connect calendar","connectGoogleCalendar": "Google Calendar","connectMicrosoftCalendar": "Microsoft Calendar",@@ -597,8 +597,6 @@"noCalendars": "No calendars found","noCalendarsDescription": "No calendars found","noChanges": "No changes",- "noConferencingAccounts": "No accounts connected",- "noConferencingAccountsDescription": "Connect an account and we'll add a meeting link to your events for you.","noDatesSelected": "No dates selected","noDatesSelectedDescription": "Click on a date to add a time slot","noDeliveriesYet": "No deliveries yet",diff --git a/apps/web/src/app/[locale]/(space)/settings/conferencing/page.tsx b/apps/web/src/app/[locale]/(space)/settings/conferencing/page.tsxindex 3d2d5c71a..eb2a471a0 100644--- a/apps/web/src/app/[locale]/(space)/settings/conferencing/page.tsx+++ b/apps/web/src/app/[locale]/(space)/settings/conferencing/page.tsx@@ -4,7 +4,6 @@ import { Suspense } from "react";import { PageSection, PageSectionContent } from "@/components/page-layout";import {SettingsPage,- SettingsPageAction,SettingsPageContent,SettingsPageDescription,SettingsPageHeader,@@ -12,12 +11,13 @@ import {} from "@/components/settings-layout";import { Spinner } from "@/components/spinner";import { ConferencingConnectionFlash } from "@/features/conferencing/components/conferencing-connection-flash";-import { ConferencingConnectionList } from "@/features/conferencing/components/conferencing-connection-list";-import { ConnectConferencingDropdown } from "@/features/conferencing/components/connect-conferencing-dropdown";+import { ConferencingProviderList } from "@/features/conferencing/components/conferencing-provider-list";import {loadAvailableConferencingProviders,loadConferencingConnections,} from "@/features/conferencing/loaders";+import type { ConferencingProvider } from "@/features/conferencing/schema";+import { conferencingProviderSchema } from "@/features/conferencing/schema";import { integrationIdToConferencingProvider } from "@/features/conferencing/utils";import { Trans } from "@/i18n/client";import { getTranslation } from "@/i18n/server";@@ -32,11 +32,6 @@ async function AvailabilityGate() {return null;}-async function ConnectAction() {- const providers = await loadAvailableConferencingProviders();- return <ConnectConferencingDropdown providers={providers} />;-}-export default function ConferencingPage() {if (!isFeatureEnabled("conferencing")) {notFound();@@ -58,17 +53,12 @@ export default function ConferencingPage() {defaults="Connect the tools you use for video calls so we can add meeting links to your events."/></SettingsPageDescription>- <SettingsPageAction>- <Suspense fallback={null}>- <ConnectAction />- </Suspense>- </SettingsPageAction></SettingsPageHeader><SettingsPageContent><PageSection><PageSectionContent><Suspense fallback={<Spinner />}>- <ConnectionList />+ <ProviderList /></Suspense></PageSectionContent></PageSection>@@ -77,17 +67,39 @@ export default function ConferencingPage() {);}-async function ConnectionList() {- const connections = await loadConferencingConnections();+async function ProviderList() {+ const [available, connections] = await Promise.all([+ loadAvailableConferencingProviders(),+ loadConferencingConnections(),+ ]);// The stored provider is the OAuth provider ("google"); the form and icons// speak in conferencing providers, which the integration id identifies.- const items = connections.flatMap((connection) => {+ const connected = new Map<+ ConferencingProvider,+ { id: string; email: string }+ >();+ for (const connection of connections) {const provider = integrationIdToConferencingProvider(connection.integrationId,);- return provider ? [{ ...connection, provider }] : [];- });- return <ConferencingConnectionList connections={items} />;+ // Connections come oldest first, and the oldest is the one finalizing uses.+ if (provider && !connected.has(provider)) {+ connected.set(provider, { id: connection.id, email: connection.email });+ }+ }+ // A provider no longer offered stays listed while connected, so it can+ // still be disconnected.+ const providers = conferencingProviderSchema.options.filter(+ (provider) => available.includes(provider) || connected.has(provider),+ );+ return (+ <ConferencingProviderList+ providers={providers.map((provider) => ({+ provider,+ connection: connected.get(provider) ?? null,+ }))}+ />+ );}export async function generateMetadata(): Promise<Metadata> {diff --git a/apps/web/src/features/conferencing/components/conferencing-connection-list.tsx b/apps/web/src/features/conferencing/components/conferencing-connection-list.tsxdeleted file mode 100644index 0ab5b89a7..000000000--- a/apps/web/src/features/conferencing/components/conferencing-connection-list.tsx+++ /dev/null@@ -1,118 +0,0 @@-"use client";--import { mutationOptions } from "@next-safe-action/adapter-tanstack-query";-import { Button } from "@rallly/ui/button";-import {- DropdownMenu,- DropdownMenuContent,- DropdownMenuItem,- DropdownMenuTrigger,-} from "@rallly/ui/dropdown-menu";-import { toast } from "@rallly/ui/sonner";-import { useMutation } from "@tanstack/react-query";-import { MoreVerticalIcon, UnplugIcon, VideoIcon } from "lucide-react";-import {- EmptyState,- EmptyStateDescription,- EmptyStateIcon,- EmptyStateTitle,-} from "@/components/empty-state";-import { disconnectConferencingConnectionAction } from "@/features/conferencing/actions";-import { ConferencingProviderIcon } from "@/features/conferencing/components/conferencing-provider-icon";-import type { ConferencingProvider } from "@/features/conferencing/schema";-import { conferencingProviderLabels } from "@/features/conferencing/utils";-import { Trans, useTranslation } from "@/i18n/client";--export function ConferencingConnectionList({- connections,-}: {- connections: {- id: string;- provider: ConferencingProvider;- email: string;- displayName: string | null;- }[];-}) {- const { t } = useTranslation();- const disconnect = useMutation(- mutationOptions(disconnectConferencingConnectionAction, {- onSuccess: () => {- toast.success(- t("conferencingDisconnected", {- defaultValue: "Account disconnected",- }),- );- },- }),- );-- if (connections.length === 0) {- return (- <EmptyState>- <EmptyStateIcon>- <VideoIcon />- </EmptyStateIcon>- <EmptyStateTitle>- <Trans- i18nKey="noConferencingAccounts"- defaults="No accounts connected"- />- </EmptyStateTitle>- <EmptyStateDescription>- <Trans- i18nKey="noConferencingAccountsDescription"- defaults="Connect an account and we'll add a meeting link to your events for you."- />- </EmptyStateDescription>- </EmptyState>- );- }-- return (- <ul className="space-y-4">- {connections.map((connection) => (- <li- key={connection.id}- className="flex items-center gap-x-4 rounded-xl border p-4"- >- <ConferencingProviderIcon provider={connection.provider} size={32} />- <div className="min-w-0 flex-1">- <p className="font-semibold text-sm">- {connection.displayName ??- conferencingProviderLabels[connection.provider]}- </p>- <p className="truncate text-muted-foreground text-sm">- {connection.email}- </p>- </div>- <DropdownMenu>- <DropdownMenuTrigger- render={- <Button- aria-label={t("moreOptions", {- defaultValue: "More options",- })}- variant="ghost"- size="icon"- />- }- >- <MoreVerticalIcon className="text-muted-foreground" />- </DropdownMenuTrigger>- <DropdownMenuContent align="end">- <DropdownMenuItem- variant="destructive"- onClick={() => {- disconnect.mutate({ id: connection.id });- }}- >- <UnplugIcon />- <Trans i18nKey="disconnect" defaults="Disconnect" />- </DropdownMenuItem>- </DropdownMenuContent>- </DropdownMenu>- </li>- ))}- </ul>- );-}diff --git a/apps/web/src/features/conferencing/components/conferencing-provider-list.tsx b/apps/web/src/features/conferencing/components/conferencing-provider-list.tsxnew file mode 100644index 000000000..7630351bf--- /dev/null+++ b/apps/web/src/features/conferencing/components/conferencing-provider-list.tsx@@ -0,0 +1,108 @@+"use client";++import { mutationOptions } from "@next-safe-action/adapter-tanstack-query";+import { Button } from "@rallly/ui/button";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,+} from "@rallly/ui/dropdown-menu";+import { toast } from "@rallly/ui/sonner";+import { useMutation } from "@tanstack/react-query";+import { MoreVerticalIcon, UnplugIcon } from "lucide-react";+import { StackedList, StackedListItem } from "@/components/stacked-list";+import { disconnectConferencingConnectionAction } from "@/features/conferencing/actions";+import { connectToConferencing } from "@/features/conferencing/client";+import { ConferencingProviderIcon } from "@/features/conferencing/components/conferencing-provider-icon";+import type { ConferencingProvider } from "@/features/conferencing/schema";+import {+ conferencingProviderIntegrations,+ conferencingProviderLabels,+} from "@/features/conferencing/utils";+import { Trans, useTranslation } from "@/i18n/client";++export function ConferencingProviderList({+ providers,+}: {+ providers: {+ provider: ConferencingProvider;+ connection: { id: string; email: string } | null;+ }[];+}) {+ const { t } = useTranslation();+ const disconnect = useMutation(+ mutationOptions(disconnectConferencingConnectionAction, {+ onSuccess: () => {+ toast.success(+ t("conferencingDisconnected", {+ defaultValue: "Account disconnected",+ }),+ );+ },+ }),+ );++ return (+ <StackedList>+ {providers.map(({ provider, connection }) => (+ <StackedListItem+ key={provider}+ className="gap-x-4 hover:bg-transparent"+ >+ <span className="shrink-0">+ <ConferencingProviderIcon provider={provider} size={32} />+ </span>+ <p className="shrink-0 font-semibold text-sm">+ {conferencingProviderLabels[provider]}+ </p>+ <div className="ml-auto flex min-w-0 items-center gap-x-2">+ {connection ? (+ <>+ <p className="truncate text-muted-foreground text-sm">+ {connection.email}+ </p>+ <DropdownMenu>+ <DropdownMenuTrigger+ render={+ <Button+ aria-label={t("moreOptions", {+ defaultValue: "More options",+ })}+ variant="ghost"+ size="icon"+ />+ }+ >+ <MoreVerticalIcon className="text-muted-foreground" />+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ <DropdownMenuItem+ variant="destructive"+ onClick={() => {+ disconnect.mutate({ id: connection.id });+ }}+ >+ <UnplugIcon />+ <Trans i18nKey="disconnect" defaults="Disconnect" />+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ </>+ ) : (+ <Button+ onClick={() => {+ connectToConferencing(+ conferencingProviderIntegrations[provider].integrationId,+ );+ }}+ >+ <Trans i18nKey="connect" defaults="Connect" />+ </Button>+ )}+ </div>+ </StackedListItem>+ ))}+ </StackedList>+ );+}diff --git a/apps/web/src/features/conferencing/components/connect-conferencing-dropdown.tsx b/apps/web/src/features/conferencing/components/connect-conferencing-dropdown.tsxdeleted file mode 100644index 0c99918fa..000000000--- a/apps/web/src/features/conferencing/components/connect-conferencing-dropdown.tsx+++ /dev/null@@ -1,49 +0,0 @@-"use client";--import { Button } from "@rallly/ui/button";-import {- DropdownMenu,- DropdownMenuContent,- DropdownMenuItem,- DropdownMenuTrigger,-} from "@rallly/ui/dropdown-menu";-import { ChevronDownIcon, PlusIcon } from "lucide-react";-import { connectToConferencing } from "@/features/conferencing/client";-import { ConferencingProviderIcon } from "@/features/conferencing/components/conferencing-provider-icon";-import type { ConferencingProvider } from "@/features/conferencing/schema";-import {- conferencingProviderIntegrations,- conferencingProviderLabels,-} from "@/features/conferencing/utils";-import { Trans } from "@/i18n/client";--export function ConnectConferencingDropdown({- providers,-}: {- providers: ConferencingProvider[];-}) {- return (- <DropdownMenu>- <DropdownMenuTrigger render={<Button />}>- <PlusIcon data-icon="inline-start" />- <Trans i18nKey="connectAccount" defaults="Connect account" />- <ChevronDownIcon data-icon="inline-end" />- </DropdownMenuTrigger>- <DropdownMenuContent align="end">- {providers.map((provider) => (- <DropdownMenuItem- key={provider}- onClick={() => {- connectToConferencing(- conferencingProviderIntegrations[provider].integrationId,- );- }}- >- <ConferencingProviderIcon provider={provider} size={16} />- {conferencingProviderLabels[provider]}- </DropdownMenuItem>- ))}- </DropdownMenuContent>- </DropdownMenu>- );-}diff --git a/apps/web/src/features/conferencing/mutations.ts b/apps/web/src/features/conferencing/mutations.tsindex aad248816..430e0a5ec 100644--- a/apps/web/src/features/conferencing/mutations.ts+++ b/apps/web/src/features/conferencing/mutations.ts@@ -28,7 +28,7 @@ export const createConferencingConnection = async ({displayName: string;userInfo: UserInfo;}) => {- return await prisma.conferencingConnection.upsert({+ const connection = await prisma.conferencingConnection.upsert({where: {user_provider_account_unique: {userId,@@ -50,6 +50,19 @@ export const createConferencingConnection = async ({email: userInfo.email,},});++ // A poll names only the provider, so a second account for the same+ // integration would never host a meeting. Connecting one replaces the rest.+ const replaced = await prisma.conferencingConnection.findMany({+ where: { userId, integrationId, id: { not: connection.id } },+ select: { id: true, provider: true, credentialId: true },+ });++ for (const previous of replaced) {+ await removeConferencingConnection(previous);+ }++ return connection;};export const disconnectConferencingConnection = async ({diff --git a/apps/web/tests/conferencing.spec.ts b/apps/web/tests/conferencing.spec.tsindex 6af95d9c1..dd39259e4 100644--- a/apps/web/tests/conferencing.spec.ts+++ b/apps/web/tests/conferencing.spec.ts@@ -76,16 +76,13 @@ test.describeawait prisma.user.delete({ where: { id: userId } });});- test("settings page starts empty and offers the configured providers", async () => {+ test("settings page lists the configured providers to connect", async () => {await page.goto("/settings/conferencing");await expect(page.getByRole("heading", { name: "Conferencing" }),).toBeVisible();- await expect(page.getByText("No accounts connected")).toBeVisible();-- await page.getByRole("button", { name: "Connect account" }).click();- await expect(page.getByRole("menuitem", { name: "Zoom" })).toBeVisible();- await page.keyboard.press("Escape");+ await expect(page.getByText("Zoom", { exact: true })).toBeVisible();+ await expect(page.getByRole("button", { name: "Connect" })).toBeVisible();});test("poll form blocks a provider the organizer has not connected", async () => {@@ -113,6 +110,9 @@ test.describeawait expect(page.getByText(`organizer-${runId}@zoom.example`),).toBeVisible();+ await expect(page.getByRole("button", { name: "Connect" })).toHaveCount(+ 0,+ );});test("poll form accepts a connected provider and stores it", async () => {@@ -203,7 +203,7 @@ test.describeawait page.goto("/settings/conferencing");await page.getByRole("button", { name: "More options" }).click();await page.getByRole("menuitem", { name: "Disconnect" }).click();- await expect(page.getByText("No accounts connected")).toBeVisible();+ await expect(page.getByRole("button", { name: "Connect" })).toBeVisible();expect(await prisma.conferencingConnection.count({ where: { userId } }),).toBe(0);@@ -246,7 +246,7 @@ test.describeawait page.goto("/settings/conferencing");await page.getByRole("button", { name: "More options" }).click();await page.getByRole("menuitem", { name: "Disconnect" }).click();- await expect(page.getByText("No accounts connected")).toBeVisible();+ await expect(page.getByText(email)).toHaveCount(0);expect(await prisma.credential.count({ where: { id: credential.id } }),).toBe(1);