feat: Add allowAliasDeletion field to admin settings

This commit is contained in:
Myzel394 2023-02-12 21:15:07 +01:00
parent 9a7b868301
commit 28e645abcb
4 changed files with 35 additions and 0 deletions

View File

@ -383,6 +383,10 @@
"allowStatistics": { "allowStatistics": {
"label": "Allow statistics", "label": "Allow statistics",
"description": "If enabled, your instance will collect anonymous statistics and share them. They will only be stored locally on this instance but made public." "description": "If enabled, your instance will collect anonymous statistics and share them. They will only be stored locally on this instance but made public."
},
"allowAliasDeletion": {
"label": "Allow alias deletion",
"description": "If enabled, users will be able to delete their aliases."
} }
} }
}, },

View File

@ -11,4 +11,5 @@ export const DEFAULT_ADMIN_SETTINGS: AdminSettings = {
imageProxyStorageLifeTimeInHours: 24, imageProxyStorageLifeTimeInHours: 24,
enableImageProxy: true, enableImageProxy: true,
allowStatistics: true, allowStatistics: true,
allowAliasDeletion: false,
} }

View File

@ -488,6 +488,35 @@ export default function SettingsForm({settings, queryKey}: SettingsFormProps) {
</FormHelperText> </FormHelperText>
</FormGroup> </FormGroup>
</Grid> </Grid>
<Grid item>
<FormGroup key="allow_alias_deletion">
<FormControlLabel
control={
<Checkbox
checked={formik.values.allowAliasDeletion!}
onChange={formik.handleChange}
name="allowAliasDeletion"
/>
}
disabled={formik.isSubmitting}
label={t(
"routes.AdminRoute.forms.settings.allowAliasDeletion.label",
)}
/>
<FormHelperText
error={
formik.touched.allowAliasDeletion &&
Boolean(formik.errors.allowAliasDeletion)
}
>
{(formik.touched.allowAliasDeletion &&
formik.errors.allowAliasDeletion) ||
t(
"routes.AdminRoute.forms.settings.allowAliasDeletion.description",
)}
</FormHelperText>
</FormGroup>
</Grid>
</Grid> </Grid>
</Grid> </Grid>
<Grid item> <Grid item>

View File

@ -210,4 +210,5 @@ export interface AdminSettings {
userEmailEnableDisposableEmails: boolean userEmailEnableDisposableEmails: boolean
userEmailEnableOtherRelays: boolean | null userEmailEnableOtherRelays: boolean | null
allowStatistics: boolean | null allowStatistics: boolean | null
allowAliasDeletion: boolean | null
} }