Skip to content

Commit

Permalink
fix: Validate space settings on proposal creation (#4403)
Browse files Browse the repository at this point in the history
Co-authored-by: Wan <[email protected]>
  • Loading branch information
samuveth and wa0x6e authored Nov 28, 2023
1 parent 5b5d4db commit bf6f64b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/components/SpaceCreateWarnings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const props = defineProps<{
space: ExtendedSpace;
validationFailed: boolean;
isValidAuthor: boolean;
isValidSpace: boolean;
validationName: string;
containsShortUrl: boolean;
}>();
Expand Down Expand Up @@ -43,6 +44,12 @@ const strategySymbolsString = computed(() => {
<div class="mb-4 space-y-2">
<MessageWarningHibernated v-if="space.hibernated" :space="space" />

<BaseMessageBlock v-else-if="!isValidSpace" level="warning">
Proposal creation is blocked due to invalid space settings. Please contact
a space admin or if you are an admin head over to the settings page and
save them again.
</BaseMessageBlock>

<MessageWarningGnosisNetwork
v-else-if="isGnosisAndNotSpaceNetwork"
:space="space"
Expand Down
8 changes: 7 additions & 1 deletion src/views/SpaceCreate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ const { isGnosisAndNotSpaceNetwork } = useGnosis(props.space);
const { isSnapshotLoading } = useSnapshot();
const { apolloQuery, queryLoading } = useApolloQuery();
const { containsShortUrl } = useShortUrls();
const { isValid: isValidSpaceSettings, populateForm } =
useFormSpaceSettings('settings');
const {
form,
Expand Down Expand Up @@ -405,6 +407,8 @@ onBeforeRouteLeave(async () => {
resetForm();
}
});
onMounted(() => populateForm(props.space));
</script>

<template>
Expand All @@ -425,6 +429,7 @@ onBeforeRouteLeave(async () => {
:space="space"
:validation-failed="hasAuthorValidationFailed"
:is-valid-author="isValidAuthor"
:is-valid-space="isValidSpaceSettings"
:validation-name="validationName"
:contains-short-url="formContainsShortUrl"
data-testid="create-proposal-connect-wallet-warning"
Expand Down Expand Up @@ -494,7 +499,8 @@ onBeforeRouteLeave(async () => {
hasAuthorValidationFailed ||
validationLoading ||
isGnosisAndNotSpaceNetwork ||
space.hibernated
space.hibernated ||
!isValidSpaceSettings
"
primary
:data-testid="
Expand Down

0 comments on commit bf6f64b

Please sign in to comment.