From d75888b6a9537a94e024b6408258d3af80507b9c Mon Sep 17 00:00:00 2001 From: ChaituVR Date: Tue, 15 Oct 2024 23:02:49 +0530 Subject: [PATCH] fix: Keep existing labels on spaces and proposals --- src/composables/useClient.ts | 2 +- src/composables/useFormSpaceProposal.ts | 3 +++ src/composables/useFormSpaceSettings.ts | 1 + src/helpers/queries.ts | 7 +++++++ src/views/SpaceCreate.vue | 1 + 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/composables/useClient.ts b/src/composables/useClient.ts index 50e7532166dc..1909cafbc66c 100644 --- a/src/composables/useClient.ts +++ b/src/composables/useClient.ts @@ -68,7 +68,7 @@ export function useClient() { body: payload.body, discussion: payload.discussion, choices: payload.choices, - labels: [], + labels: payload.labels, plugins: JSON.stringify(plugins) }); } else if (type === 'vote') { diff --git a/src/composables/useFormSpaceProposal.ts b/src/composables/useFormSpaceProposal.ts index a4b7732bd373..49d04931ee84 100644 --- a/src/composables/useFormSpaceProposal.ts +++ b/src/composables/useFormSpaceProposal.ts @@ -9,6 +9,7 @@ interface ProposalForm { body: string; discussion: string; choices: { key: number; text: string }[]; + labels: string[]; start: number; end: number; snapshot: number; @@ -29,6 +30,7 @@ const EMPTY_PROPOSAL: ProposalForm = { { key: 0, text: '' }, { key: 1, text: '' } ], + labels: [], start: parseInt((Date.now() / 1e3).toFixed()), end: 0, snapshot: 0, @@ -60,6 +62,7 @@ export function useFormSpaceProposal({ spaceType = 'default' } = {}) { name: string; body: string; choices: { key: number; text: string }[]; + labels: string[]; isBodySet: boolean; }>(`snapshot.proposal.${route.params.key}`, clone(EMPTY_PROPOSAL_DRAFT)); diff --git a/src/composables/useFormSpaceSettings.ts b/src/composables/useFormSpaceSettings.ts index 00d82058ef87..d73d1e06f457 100644 --- a/src/composables/useFormSpaceSettings.ts +++ b/src/composables/useFormSpaceSettings.ts @@ -16,6 +16,7 @@ const DEFAULT_DELEGATION = { const EMPTY_SPACE_FORM = { strategies: [], categories: [], + labels: [], treasuries: [], admins: [], moderators: [], diff --git a/src/helpers/queries.ts b/src/helpers/queries.ts index eacc199b3491..08d8c175ebd3 100644 --- a/src/helpers/queries.ts +++ b/src/helpers/queries.ts @@ -46,6 +46,7 @@ export const PROPOSAL_QUERY = gql` body discussion choices + labels start end snapshot @@ -460,6 +461,12 @@ export const SPACE_QUERY = gql` moderators members categories + labels { + id + name + description + color + } plugins followersCount template diff --git a/src/views/SpaceCreate.vue b/src/views/SpaceCreate.vue index cda8027ce4e9..5c8d00b3ab63 100644 --- a/src/views/SpaceCreate.vue +++ b/src/views/SpaceCreate.vue @@ -298,6 +298,7 @@ function setSourceProposal(proposal) { body: proposal.body, discussion: proposal.discussion, choices: proposal.choices, + labels: proposal.labels, start: proposal.start, end: proposal.end, snapshot: proposal.snapshot,