diff --git a/package.json b/package.json index 6c6e60ced9e6..9c4ff850075c 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@shutter-network/shutter-crypto": "0.1.0-beta.3", "@snapshot-labs/lock": "^0.2.0", "@snapshot-labs/pineapple": "^1.1.0", - "@snapshot-labs/snapshot.js": "^0.6.4", + "@snapshot-labs/snapshot.js": "^0.7.0", "@snapshot-labs/tune": "^0.1.33", "@vue/apollo-composable": "4.0.0-beta.4", "@vueuse/core": "^10.4.0", diff --git a/snapshot-spaces b/snapshot-spaces index e33ec03bd37b..423c33e8bd2a 160000 --- a/snapshot-spaces +++ b/snapshot-spaces @@ -1 +1 @@ -Subproject commit e33ec03bd37bc4e3184a9c193ff4af51b89ca864 +Subproject commit 423c33e8bd2a3130bec73918e2daf1f3f89ed8d0 diff --git a/src/components/SpaceProposalHeader.vue b/src/components/SpaceProposalHeader.vue index 0df21d259d81..8953f4cced9f 100644 --- a/src/components/SpaceProposalHeader.vue +++ b/src/components/SpaceProposalHeader.vue @@ -23,6 +23,12 @@ const threeDotItems = computed(() => { if (isCreator.value) items.push({ text: t('edit'), action: 'edit' }); items.push({ text: t('duplicate'), action: 'duplicate' }); items.push({ 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 +57,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' || e === 'edit') { resetForm(); router.push({ @@ -152,7 +163,9 @@ watch(
- + {{ item.text }}
diff --git a/src/composables/useClient.ts b/src/composables/useClient.ts index a170e5a233cf..a889b459a5c3 100644 --- a/src/composables/useClient.ts +++ b/src/composables/useClient.ts @@ -97,6 +97,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 50bf3dba2629..24374076b690 100644 --- a/src/locales/default.json +++ b/src/locales/default.json @@ -156,6 +156,7 @@ "copyLink": "Copy link", "duplicate": "Duplicate", "report": "Report", + "flag": "Flag", "joinedSpaces": "Joined spaces", "joinSpaces": "Join spaces", "setDelegationToSpace": "Limit delegation to a specific space", diff --git a/yarn.lock b/yarn.lock index 4a7afa5d3968..a99d58b4d93f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1853,10 +1853,10 @@ dependencies: ofetch "^1.3.3" -"@snapshot-labs/snapshot.js@^0.6.4": - version "0.6.4" - resolved "https://registry.yarnpkg.com/@snapshot-labs/snapshot.js/-/snapshot.js-0.6.4.tgz#09f08ab8db0e16c172861438ffe8da3ffe5ac5ef" - integrity sha512-De8HWZrXhiV0D97Tp6CclZTXsQg4ePIu0grOym1sfvpHM/ILs4uoox634nDS4zE+/2/6SLp43fMo9dF5j6DXlw== +"@snapshot-labs/snapshot.js@^0.7.0": + version "0.7.0" + resolved "https://registry.yarnpkg.com/@snapshot-labs/snapshot.js/-/snapshot.js-0.7.0.tgz#50c16ada2bc7011a77edb02c38ddbc08e6331050" + integrity sha512-rmV4vlhEugnegHOUm7pq+p8OlzqiHv9JUMP5ZYc2vxAbLkibopk3x5o4ggaKxxNzDDzfOZMMCOZf3nzGMTMVCw== dependencies: "@ensdomains/eth-ens-namehash" "^2.0.15" "@ethersproject/abi" "^5.6.4"