diff --git a/package.json b/package.json index 3678186ca4f6..cbd637f788a2 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,8 @@ }, "dependencies": { "@adraffy/ens-normalize": "^1.9.4", - "@braintree/sanitize-url": "^6.0.4", "@apollo/client": "^3.8.3", + "@braintree/sanitize-url": "^6.0.4", "@ensdomains/eth-ens-namehash": "^2.0.15", "@ethersproject/abi": "^5.7.0", "@ethersproject/address": "^5.7.0", @@ -45,7 +45,7 @@ "@shutter-network/shutter-crypto": "0.1.0-beta.3", "@snapshot-labs/lock": "^0.2.0", "@snapshot-labs/pineapple": "^0.2.0", - "@snapshot-labs/snapshot.js": "^0.5.8", + "@snapshot-labs/snapshot.js": "^0.6.0", "@snapshot-labs/tune": "^0.1.33", "@vue/apollo-composable": "4.0.0-beta.4", "@vueuse/core": "^10.4.0", diff --git a/src/components/SpaceProposalHeader.vue b/src/components/SpaceProposalHeader.vue index 84fd9abd3ba8..2f8001c1de6e 100644 --- a/src/components/SpaceProposalHeader.vue +++ b/src/components/SpaceProposalHeader.vue @@ -23,6 +23,8 @@ const threeDotItems = computed(() => { { 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' }); if (props.isAdmin || props.isModerator || isCreator.value) items.push({ text: t('delete'), action: 'delete' }); return items; @@ -51,10 +53,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({ @@ -151,6 +158,7 @@ watch(
+ {{ item.text }}
diff --git a/src/composables/useClient.ts b/src/composables/useClient.ts index 2131bf7b8351..0213e4b8cc03 100644 --- a/src/composables/useClient.ts +++ b/src/composables/useClient.ts @@ -83,6 +83,11 @@ export function useClient() { about: payload.about, statement: payload.statement }); + } else if (type === 'flag-proposal') { + return client.flagProposal(auth.web3, web3.value.account, { + space: space.id, + proposal: payload.proposal.id + }); } } diff --git a/src/locales/default.json b/src/locales/default.json index a068aa36c10c..c9789276e9ff 100644 --- a/src/locales/default.json +++ b/src/locales/default.json @@ -156,6 +156,7 @@ "copyLink": "Copy link", "duplicate": "Duplicate", "report": "Report", + "flag": "Flag proposal", "joinedSpaces": "Joined spaces", "joinSpaces": "Join spaces", "setDelegationToSpace": "Limit delegation to a specific space", diff --git a/yarn.lock b/yarn.lock index a755327ae062..67ebd6f16069 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1869,10 +1869,10 @@ dependencies: cross-fetch "^3.1.5" -"@snapshot-labs/snapshot.js@^0.5.8": - version "0.5.8" - resolved "https://registry.yarnpkg.com/@snapshot-labs/snapshot.js/-/snapshot.js-0.5.8.tgz#16bf19b27e487e937be8472e53f0ed71f25e47af" - integrity sha512-bFe4VBUOD2LbKKesD52G7hqBCrmx7BS/4n8JfnzR+GZddL4UWmjRhfnxx/6YLeJvaHOWSPs7LHkr16fpJXD7pQ== +"@snapshot-labs/snapshot.js@^0.6.0": + version "0.6.0" + resolved "https://registry.yarnpkg.com/@snapshot-labs/snapshot.js/-/snapshot.js-0.6.0.tgz#e954056108871fd57bb74fd8cc404c6a5771f81f" + integrity sha512-vMHIiQYCIQLiPg0IO5RPy+nUOhvNE6nVLPiupOFD/7p1LiDwdqn5qdegdbYTPzEbvBp3rccQfFgj9uyjUM0dhw== dependencies: "@ensdomains/eth-ens-namehash" "^2.0.15" "@ethersproject/abi" "^5.6.4"