Skip to content

Commit

Permalink
feat(proposal): add ability to flag proposals for admins and moderato…
Browse files Browse the repository at this point in the history
…rs (#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 <[email protected]>
Co-authored-by: Chaitanya <[email protected]>
  • Loading branch information
3 people authored Sep 28, 2023
1 parent 07315b6 commit 7938ed1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/components/SpaceProposalHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -150,7 +159,7 @@ watch(
<template #item="{ item }">
<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-flag v-if="item.action === 'report' || 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",
"joinedSpaces": "Joined spaces",
"joinSpaces": "Join spaces",
"setDelegationToSpace": "Limit delegation to a specific space",
Expand Down

1 comment on commit 7938ed1

@vercel
Copy link

@vercel vercel bot commented on 7938ed1 Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.