Skip to content

Commit

Permalink
fix: use settings basic update to reactivate space
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Nov 15, 2023
1 parent 4329589 commit da65260
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/components/MessageWarningHibernated.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,44 @@ const { reloadSpace } = useExtendedSpaces();
const { loadSpaceController, isSpaceController } = useSpaceController();
const { notify } = useFlashNotification();
const { t } = useI18n();
const {
isValid,
prunedForm,
populateForm
} = useFormSpaceSettings('settings');
async function handleReactivateSpace() {
const receipt = await send(props.space, 'reactivate-space', {
space: props.space
});
const result = await send(props.space, 'settings', prunedForm.value);
if (receipt.id) {
if (result.id) {
await reloadSpace(props.space.id);
notify(['green', t('notify.spaceReactivated')]);
}
}
const isAdmin = computed(() => {
const isAuthorized = computed(() => {
const admins = (props.space.admins || []).map(admin => admin.toLowerCase());
return admins.includes(web3Account.value?.toLowerCase());
return admins.includes(web3Account.value?.toLowerCase()) || isSpaceController;
});
onMounted(async () => {
await loadSpaceController();
if (isAuthorized.value) {
populateForm(props.space);
}
});
</script>

<template>
<BaseMessageBlock v-if="space.hibernated" level="warning" is-responsive>
{{ $t('create.errorSpaceHibernated') }}
<BaseLink
link="https://docs.snapshot.org/user-guides/spaces/space-hibernation"
>
<BaseLink link="https://docs.snapshot.org/user-guides/spaces/space-hibernation">
{{ $t('learnMore') }}
</BaseLink>

<p v-if="isAdmin || isSpaceController" class="mt-3">
<BaseButton :loading="isSending" @click="handleReactivateSpace">
<p v-if="isAuthorized" class="mt-3">
<BaseButton :disabled="!isValid" :loading="isSending" @click="handleReactivateSpace">
{{ $t('reactivateSpace') }}
</BaseButton>
</p>
Expand Down
1 change: 1 addition & 0 deletions src/composables/useFormSpaceSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export function useFormSpaceSettings(context: 'setup' | 'settings') {
delete formData.followersCount;
delete formData.verified;
delete formData.flagged;
delete formData.hibernated;

if (formData.filters.invalids) delete formData.filters.invalids;
}
Expand Down

0 comments on commit da65260

Please sign in to comment.