Feat: Delete feedback from delete workspace modal (#5113)

This commit is contained in:
Mike
2025-07-21 22:26:50 +02:00
committed by GitHub
parent 9260c9ee71
commit bf11528ab0
3 changed files with 2 additions and 67 deletions
@@ -21,17 +21,6 @@
class="text-sm mb-2"
color="foundation"
/>
<FormTextArea
v-model="feedback"
name="reasonForDeletion"
label="Why did you delete this workspace?"
placeholder="We want to improve so we're curious about your honest feedback"
show-label
show-optional
full-width
class="text-sm mb-2"
color="foundation"
/>
</LayoutDialog>
</template>
@@ -54,9 +43,7 @@ import {
import { ToastNotificationType, useGlobalToast } from '~~/lib/common/composables/toast'
import { useActiveUser } from '~~/lib/auth/composables/activeUser'
import { isUndefined } from 'lodash-es'
import { homeRoute, defaultZapierWebhookUrl } from '~/lib/common/helpers/route'
import { useZapier } from '~/lib/core/composables/zapier'
import { useForm } from 'vee-validate'
import { homeRoute } from '~/lib/common/helpers/route'
import type { MaybeNullOrUndefined } from '@speckle/shared'
import { useNavigation } from '~/lib/navigation/composables/navigation'
@@ -78,19 +65,16 @@ const { triggerNotification } = useGlobalToast()
const { activeUser } = useActiveUser()
const router = useRouter()
const apollo = useApolloClient().client
const { sendWebhook } = useZapier()
const { resetForm } = useForm<{ feedback: string }>()
const { mutateActiveWorkspaceSlug } = useNavigation()
const workspaceNameInput = ref('')
const feedback = ref('')
const onDelete = async () => {
if (!props.workspace) return
if (workspaceNameInput.value !== props.workspace.name) return
// Create a copy of the workspace name and ID before deletion to avoid errors after deletion/cache update
const { name: workspaceName, id: workspaceId } = props.workspace
const { name: workspaceName } = props.workspace
const cache = apollo.cache
const result = await deleteWorkspace({
workspaceId: props.workspace.id
@@ -121,18 +105,6 @@ const onDelete = async () => {
)
}
if (feedback.value) {
await sendWebhook(defaultZapierWebhookUrl, {
feedback: [
`**Action:** Workspace Deleted`,
`**Workspace:** ${workspaceName}`,
`**User ID:** ${activeUser.value?.id}`,
`**Workspace ID:** ${workspaceId}`,
`**Feedback:** ${feedback.value}`
].join('\n')
})
}
triggerNotification({
type: ToastNotificationType.Success,
title: `${workspaceName} workspace deleted`
@@ -168,8 +140,4 @@ const dialogButtons = computed((): LayoutDialogButton[] => [
onClick: onDelete
}
])
watch(isOpen, () => {
resetForm()
})
</script>
@@ -18,8 +18,6 @@ export const connectorsRoute = '/connectors'
export const tutorialsRoute = '/tutorials'
export const docsPageUrl = 'https://docs.speckle.systems/'
export const forumPageUrl = 'https://speckle.community/'
export const defaultZapierWebhookUrl =
'https://hooks.zapier.com/hooks/catch/12120532/2m4okri/'
export const guideBillingUrl = 'https://docs.speckle.systems/workspaces/billing'
export const bookDemoRoute = '/book-a-demo'
export const onboardingRoute = '/onboarding'
@@ -1,31 +0,0 @@
import { useServerInfo } from '~/lib/core/composables/server'
export function useZapier() {
const { serverInfo } = useServerInfo()
const sendWebhook = async (
webhookUrl: string,
data: Record<string, string | number>
) => {
const isLatest = serverInfo.value?.canonicalUrl?.includes(
'https://latest.speckle.systems/'
)
if (import.meta.dev || isLatest) return
const response = await fetch(webhookUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
mode: 'no-cors',
body: JSON.stringify(data)
})
return response
}
return {
sendWebhook
}
}