diff --git a/apps/studio/components/interfaces/Auth/EmailTemplates/TemplateEditor.test.tsx b/apps/studio/components/interfaces/Auth/EmailTemplates/TemplateEditor.test.tsx index 696e486a49..66cca15487 100644 --- a/apps/studio/components/interfaces/Auth/EmailTemplates/TemplateEditor.test.tsx +++ b/apps/studio/components/interfaces/Auth/EmailTemplates/TemplateEditor.test.tsx @@ -172,7 +172,9 @@ describe('TemplateEditor reset to default', () => { it('resets the template through the dedicated reset endpoint after confirmation', async () => { const user = userEvent.setup() - resetTemplateMock.mockImplementation((_vars, callbacks) => callbacks?.onSuccess?.(resetAuthConfig)) + resetTemplateMock.mockImplementation((_vars, callbacks) => + callbacks?.onSuccess?.(resetAuthConfig) + ) renderTemplateEditor({ hasCustomBody: true }) @@ -195,7 +197,9 @@ describe('TemplateEditor reset to default', () => { it('does not reset through the auth config update payload', async () => { const user = userEvent.setup() - resetTemplateMock.mockImplementation((_vars, callbacks) => callbacks?.onSuccess?.(resetAuthConfig)) + resetTemplateMock.mockImplementation((_vars, callbacks) => + callbacks?.onSuccess?.(resetAuthConfig) + ) renderTemplateEditor({ hasCustomBody: true }) @@ -210,9 +214,15 @@ describe('TemplateEditor reset to default', () => { it('uses the reset response as the new editor state', async () => { const user = userEvent.setup() - resetTemplateMock.mockImplementation((_vars, callbacks) => callbacks?.onSuccess?.(resetAuthConfig)) + resetTemplateMock.mockImplementation((_vars, callbacks) => + callbacks?.onSuccess?.(resetAuthConfig) + ) - renderTemplateEditor({ body: '

Custom body

', hasCustomBody: true, hasCustomSubject: true }) + renderTemplateEditor({ + body: '

Custom body

', + hasCustomBody: true, + hasCustomSubject: true, + }) await user.click(screen.getByRole('button', { name: 'Reset template' })) const dialog = await screen.findByRole('alertdialog') diff --git a/apps/studio/components/interfaces/Auth/EmailTemplates/TemplateEditor.tsx b/apps/studio/components/interfaces/Auth/EmailTemplates/TemplateEditor.tsx index 6024d5e417..6306fbf16b 100644 --- a/apps/studio/components/interfaces/Auth/EmailTemplates/TemplateEditor.tsx +++ b/apps/studio/components/interfaces/Auth/EmailTemplates/TemplateEditor.tsx @@ -122,13 +122,16 @@ export const TemplateEditor = ({ template }: TemplateEditorProps) => { const spamRules = (validationResult?.rules ?? []).filter((rule) => rule.score > 0) - const getFormValuesFromConfig = useCallback((config: AuthConfigResponse | undefined) => { - const result: { [x: string]: string } = {} - Object.keys(properties).forEach((key) => { - result[key] = ((config && config[key as keyof typeof config]) ?? '') as string - }) - return result - }, [properties]) + const getFormValuesFromConfig = useCallback( + (config: AuthConfigResponse | undefined) => { + const result: { [x: string]: string } = {} + Object.keys(properties).forEach((key) => { + result[key] = ((config && config[key as keyof typeof config]) ?? '') as string + }) + return result + }, + [properties] + ) const INITIAL_VALUES = useMemo(() => { return getFormValuesFromConfig(authConfig) @@ -434,8 +437,8 @@ export const TemplateEditor = ({ template }: TemplateEditorProps) => { Reset template to default - This will remove your custom subject line and body content. The default - template content will be used instead. + This will remove your custom subject line and email body content. The + default values will be used instead. diff --git a/apps/studio/data/auth/auth-config-update-mutation.ts b/apps/studio/data/auth/auth-config-update-mutation.ts index 2f5985d1f1..138c2e90ee 100644 --- a/apps/studio/data/auth/auth-config-update-mutation.ts +++ b/apps/studio/data/auth/auth-config-update-mutation.ts @@ -1,8 +1,8 @@ import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' -import { authKeys } from './keys' import type { ProjectAuthConfigData } from './auth-config-query' +import { authKeys } from './keys' import type { components } from '@/data/api' import { handleError, patch } from '@/data/fetchers' import { lintKeys } from '@/data/lint/keys' diff --git a/apps/studio/data/auth/auth-template-reset-mutation.ts b/apps/studio/data/auth/auth-template-reset-mutation.ts index 7fa4a1dbd1..0d644c5c62 100644 --- a/apps/studio/data/auth/auth-template-reset-mutation.ts +++ b/apps/studio/data/auth/auth-template-reset-mutation.ts @@ -1,8 +1,8 @@ import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' -import { authKeys } from './keys' import type { ProjectAuthConfigData } from './auth-config-query' +import { authKeys } from './keys' import { handleError, post } from '@/data/fetchers' import { lintKeys } from '@/data/lint/keys' import type { ResponseError, UseCustomMutationOptions } from '@/types'