From 1d5d28ae7a19c03a2c5d3b2bfbc99323c2afd170 Mon Sep 17 00:00:00 2001 From: Guilhem Date: Wed, 14 Jan 2026 21:04:20 +0000 Subject: [PATCH] fix(frontend): remove workspace invites (#7579) * disable auto invite outside cloud and legacy * Add confirmation modal and warning --- .../settings/WorkspaceUserSettings.svelte | 202 +++++++++++++++--- .../workspaceSettings/CreateWorkspace.svelte | 42 ++-- 2 files changed, 193 insertions(+), 51 deletions(-) diff --git a/frontend/src/lib/components/settings/WorkspaceUserSettings.svelte b/frontend/src/lib/components/settings/WorkspaceUserSettings.svelte index 1b9d229bbb..9f4064d579 100644 --- a/frontend/src/lib/components/settings/WorkspaceUserSettings.svelte +++ b/frontend/src/lib/components/settings/WorkspaceUserSettings.svelte @@ -1,6 +1,6 @@ Auto-{autoAdd ? 'add' : 'invite'}: {autoInviteOrAddEnabled ? 'ON' : 'OFF'} + >Auto-{displayMode}: {autoInviteOrAddEnabled ? 'ON' : 'OFF'} {/snippet} {#snippet content()} -
-
Mode Whether to invite or add users directly to the workspace. -
- { - autoAdd = e.detail === 'add' - if (autoInviteOrAddEnabled) { - await updateAutoInvite(true) - } - }} - > - {#snippet children({ item })} - - - {/snippet} - +
+ {#if showAutoInviteToggle} +
Mode Whether to invite or add users directly to the workspace. +
+ { + const switchingToAdd = e.detail === 'add' && !autoAdd - Role Role of the auto-added users + // If switching from invite to add on non-cloud, show confirmation with warning + if (switchingToAdd && isLegacyAutoInvite) { + switchToAutoAddConfirmCallback = async () => { + autoAdd = true + if (autoInviteOrAddEnabled) { + await updateAutoInvite(true) + } + } + } else { + autoAdd = e.detail === 'add' + if (autoInviteOrAddEnabled) { + await updateAutoInvite(true) + } + } + }} + > + {#snippet children({ item })} + + + {/snippet} + + + {#if isLegacyAutoInvite && !autoAdd} +
+ + Auto-invite is deprecated. Switching to auto-add will permanently disable + auto-invite for this workspace. + +
+ {/if} + +
+ {/if} + + Role Role of the auto-added users { @@ -459,15 +505,40 @@ { - await updateAutoInvite(e.detail) + const enabling = e.detail + + if (enabling) { + // Non-cloud users without legacy auto-invite: force auto-add mode + if (!isCloudHosted() && !isLegacyAutoInvite) { + autoAdd = true + } + + // Show confirmation when enabling auto-add + if (autoAdd || (!isCloudHosted() && !showAutoInviteToggle)) { + autoAddConfirmCallback = async () => { + await updateAutoInvite(true) + } + } else { + await updateAutoInvite(true) + } + } else { + // Disabling: show confirmation if currently using auto-invite (legacy) + if (isLegacyAutoInvite) { + autoInviteDisableConfirmCallback = async () => { + await updateAutoInvite(false) + } + } else { + await updateAutoInvite(false) + } + } }} disabled={isCloudHosted() && !allowedAutoDomain} options={{ right: isCloudHosted() - ? `Auto-${autoAdd ? 'add' : 'invite'} anyone from ${ + ? `Auto-${displayMode} anyone from ${ autoInviteOrAddEnabled ? auto_invite_domain : domain }` - : `Auto-${autoAdd ? 'add' : 'invite'} anyone joining the instance` + : `Auto-${displayMode} anyone joining the instance` }} />
@@ -648,7 +719,9 @@ {/if} - + {#if showAutoInviteToggle} + + {/if} { @@ -890,9 +963,11 @@ documentationLink="https://www.windmill.dev/docs/core_concepts/authentification#adding-users-to-a-workspace" > {#snippet action()} -
- -
+ {#if showAutoInviteToggle} +
+ +
+ {/if} {/snippet} @@ -1061,3 +1136,68 @@
+ + +
+ { + autoAddConfirmCallback = undefined + }} + on:confirmed={() => { + if (autoAddConfirmCallback) { + autoAddConfirmCallback() + } + autoAddConfirmCallback = undefined + }} + > + Are you sure you want to enable auto-add?
+ Anyone added to the instance will automatically join this workspace. +
+
+ +
+ { + autoInviteDisableConfirmCallback = undefined + }} + on:confirmed={() => { + if (autoInviteDisableConfirmCallback) { + autoInviteDisableConfirmCallback() + } + autoInviteDisableConfirmCallback = undefined + }} + > + Are you sure you want to disable auto-invite? Auto-invite is a legacy feature. After disabling, + it will no longer be available for this workspace. You will only be able to use auto-add.
+ Anyone added to the instance will automatically join this workspace. +
+
+ +
+ { + switchToAutoAddConfirmCallback = undefined + }} + on:confirmed={() => { + if (switchToAutoAddConfirmCallback) { + switchToAutoAddConfirmCallback() + } + switchToAutoAddConfirmCallback = undefined + }} + > + Are you sure you want to switch from auto-invite to auto-add?
+ Auto-invite is a legacy feature. After switching to auto-add, auto-invite will no longer be available + for this workspace.
+ With auto-add, anyone added to the instance will automatically join this workspace without needing + to accept an invitation. +
+
diff --git a/frontend/src/lib/components/workspaceSettings/CreateWorkspace.svelte b/frontend/src/lib/components/workspaceSettings/CreateWorkspace.svelte index 684cd7f9b4..4fd5fdaa6e 100644 --- a/frontend/src/lib/components/workspaceSettings/CreateWorkspace.svelte +++ b/frontend/src/lib/components/workspaceSettings/CreateWorkspace.svelte @@ -327,7 +327,7 @@ let auto_invite = $state(false) let operatorOnly = $state(false) - let autoAdd = $state(false) + let autoAdd = $state(true) let selected: Exclude = $state('openai') run(() => { id = name.toLowerCase().replace(/\s/gi, '-') @@ -541,8 +541,8 @@
- + {#if isCloudHosted()} + + {/if}