Skip to content

Commit 8d1fb22

Browse files
authored
feat(settings): gate TelemetryField on isEnterprise prop (#2298)
Today GeneralTabWrapper accepts an `isEnterprise` prop that hides ExperimentalFeatures. Extend the same gate to also hide the Sentry "Error reporting" toggle when set. Rebranded / enterprise builds typically ship without a Sentry DSN (`enabled: !!import.meta.env.VITE_SENTRY_DSN` is false in those builds), so the toggle is a confusing no-op for end users. Letting downstream consumers hide it via the existing prop avoids overlay-copying the whole wrapper component. OSS behavior is unchanged: `isEnterprise` defaults to `false`, so the toggle still renders in the OSS GeneralTab.
1 parent ad184c4 commit 8d1fb22

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

renderer/src/common/components/settings/tabs/__tests__/general-tab.test.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,20 @@ describe('GeneralTab', () => {
227227
).not.toBeInTheDocument()
228228
})
229229

230+
it('hides the telemetry toggle when isEnterprise is true', async () => {
231+
renderWithProviders(<GeneralTabWrapper isEnterprise={true} />)
232+
233+
await waitFor(() => {
234+
expect(screen.getByRole('heading', { name: 'General' })).toBeVisible()
235+
})
236+
237+
// Error reporting (Sentry) toggle is hidden in branded/enterprise builds
238+
// because they typically ship without a Sentry DSN — the toggle would be
239+
// a confusing no-op.
240+
expect(screen.queryByText('Error reporting')).not.toBeInTheDocument()
241+
expect(screen.queryByRole('switch', { name: /telemetry/i })).toBeNull()
242+
})
243+
230244
describe('Experimental Features', () => {
231245
it('displays message when no experimental features are available', async () => {
232246
// Override the mock to return false for experimental_features flag

renderer/src/common/components/settings/tabs/components/general-tab-wrapper.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,12 @@ export function GeneralTabWrapper({
187187
<Separator />
188188
<AutoLaunchField />
189189
<Separator />
190-
<TelemetryField />
191-
<Separator />
190+
{!isEnterprise && (
191+
<>
192+
<TelemetryField />
193+
<Separator />
194+
</>
195+
)}
192196
<QuitConfirmationField />
193197
<Separator />
194198
{children}

0 commit comments

Comments
 (0)