Skip to content

Commit

Permalink
fix form toggles (#1398)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsladerman authored Sep 18, 2024
1 parent 287a428 commit 1948c4c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions assets/src/components/pr/automations/prConfigurationUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,17 @@ export function validateAndFilterConfig(

if (conditionMet && name) {
let value: string | boolean | undefined = configVals[name]
const isBool = configItem.type === ConfigurationType.Bool

if (configItem.type === ConfigurationType.Bool) {
if (isBool) {
value = parseToBool(value)
}

if (value) {
filteredValues.push({ name, value })
if (value !== undefined || isBool) {
filteredValues.push({ name, value: value as string | boolean })
}

return (!!configItem.optional || !!value) && acc
return (!!configItem.optional || !!value || isBool) && acc
}

return acc
Expand Down
3 changes: 2 additions & 1 deletion assets/src/components/settings/global/GlobalSettingsSMTP.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export function GlobalSettingsSMTP() {
const theme = useTheme()
const { smtp } = useDeploymentSettings()
const [form, setForm] = useState<SmtpSettingsAttributes>({
...(cleanSmtpForm(smtp) || defaultForm),
...defaultForm,
...cleanSmtpForm(smtp),
password: '',
})
const [showToast, setShowToast] = useState(false)
Expand Down

0 comments on commit 1948c4c

Please sign in to comment.