diff --git a/src/components/SpaceCreateVoting.vue b/src/components/SpaceCreateVoting.vue index df39277c523..08cc1011da4 100644 --- a/src/components/SpaceCreateVoting.vue +++ b/src/components/SpaceCreateVoting.vue @@ -7,6 +7,7 @@ const props = defineProps<{ dateStart: number; dateEnd: number; osnap: { enabled: boolean; selection: boolean }; + isEditing: boolean; }>(); const { @@ -54,16 +55,13 @@ watch( { immediate: true } ); -// we need to watch for selection change to properly update the voting form stae watch( () => props.osnap.selection, () => { - // If using osnap, we can only allow basic voting, for, against, abstain if (props.osnap.selection) { form.value.type = 'basic'; - } else { - // Initialize the proposal type if set in space - if (props.space?.voting?.type) form.value.type = props.space.voting.type; + } else if (props.space?.voting?.type) { + form.value.type = props.space.voting.type; } } ); @@ -85,135 +83,139 @@ defineEmits<{ diff --git a/src/components/SpaceProposalHeader.vue b/src/components/SpaceProposalHeader.vue index a2f26b1de9e..8555a4ed199 100644 --- a/src/components/SpaceProposalHeader.vue +++ b/src/components/SpaceProposalHeader.vue @@ -19,9 +19,11 @@ const { web3Account } = useWeb3(); const isCreator = computed(() => props.proposal?.author === web3Account.value); const threeDotItems = computed(() => { - const items = [ - { text: t('duplicate'), action: 'duplicate' }, - ]; + const items: { text: string; action: string }[] = []; + if (isCreator.value && props.proposal.state === 'pending') + items.push({ text: t('edit'), action: 'edit' }); + items.push({ text: t('duplicate'), action: 'duplicate' }); + if ((props.isAdmin || props.isModerator) && !props.proposal.flagged) { items.push({ text: t('flag'), action: 'flag' }); } else { @@ -64,14 +66,15 @@ async function handleSelect(e) { proposal: props.proposal }); } - if (e === 'duplicate') { + if (e === 'duplicate' || e === 'edit') { resetForm(); router.push({ name: 'spaceCreate', params: { key: props.proposal.space.id, sourceProposal: props.proposal.id - } + }, + query: { editing: e === 'edit' ? 'true' : undefined } }); } } @@ -158,8 +161,11 @@ watch(