Skip to content

Commit

Permalink
feat(proposal): add ability to flag proposals for admins and moderators
Browse files Browse the repository at this point in the history
  • Loading branch information
Todmy committed Sep 21, 2023
1 parent 3d3da61 commit 6712ec6
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
10 changes: 9 additions & 1 deletion src/components/SpaceProposalHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -151,6 +158,7 @@ watch(
<div class="flex items-center gap-2">
<i-ho-document-duplicate v-if="item.action === 'duplicate'" />
<i-ho-flag v-if="item.action === 'report'" />
<i-ho-exclamation v-if="item.action === 'flag'" />
<i-ho-trash v-if="item.action === 'delete'" />
{{ item.text }}
</div>
Expand Down
5 changes: 5 additions & 0 deletions src/composables/useClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
}
}

Expand Down
1 change: 1 addition & 0 deletions src/locales/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 6712ec6

Please sign in to comment.