From 7938ed14ca281592037149b10f537366e4a1a22f Mon Sep 17 00:00:00 2001 From: Dmytro Tolok Date: Thu, 28 Sep 2023 13:37:18 +0200 Subject: [PATCH] feat(proposal): add ability to flag proposals for admins and moderators (#4220) * feat(proposal): add ability to flag proposals for admins and moderators * fix(flag): change the way how flag action appears in proposal --------- Co-authored-by: Sam <51686767+samuveth@users.noreply.github.com> Co-authored-by: Chaitanya --- src/components/SpaceProposalHeader.vue | 15 ++++++++++++--- src/composables/useClient.ts | 5 +++++ src/locales/default.json | 1 + 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/components/SpaceProposalHeader.vue b/src/components/SpaceProposalHeader.vue index 84fd9abd3ba8..a2f26b1de9ec 100644 --- a/src/components/SpaceProposalHeader.vue +++ b/src/components/SpaceProposalHeader.vue @@ -21,8 +21,12 @@ const isCreator = computed(() => props.proposal?.author === web3Account.value); const threeDotItems = computed(() => { const items = [ { text: t('duplicate'), action: 'duplicate' }, - { text: t('report'), action: 'report' } ]; + if ((props.isAdmin || props.isModerator) && !props.proposal.flagged) { + items.push({ text: t('flag'), action: 'flag' }); + } else { + items.push({ text: t('report'), action: 'report' }); + } if (props.isAdmin || props.isModerator || isCreator.value) items.push({ text: t('delete'), action: 'delete' }); return items; @@ -51,10 +55,15 @@ const { const { resetForm } = useFormSpaceProposal(); -function handleSelect(e) { +async function handleSelect(e) { if (!props.proposal) return; if (e === 'delete') deleteProposal(); if (e === 'report') window.open('https://tally.so/r/mDBEGb', '_blank'); + if (e === 'flag') { + await send(props.space, 'flag-proposal', { + proposal: props.proposal + }); + } if (e === 'duplicate') { resetForm(); router.push({ @@ -150,7 +159,7 @@ watch(