diff --git a/plugins/workbench-resources/src/components/EditStatuses.svelte b/plugins/workbench-resources/src/components/EditStatuses.svelte
index bc895e45f9..9bcf94c6de 100644
--- a/plugins/workbench-resources/src/components/EditStatuses.svelte
+++ b/plugins/workbench-resources/src/components/EditStatuses.svelte
@@ -148,7 +148,7 @@
{
- showPopup(StatusesPopup, { state, spaceClass }, ev.target, (result) => { if (result) console.log('StatusesPopup:', result) })
+ showPopup(StatusesPopup, { kanban, state, spaceClass }, ev.target, (result) => { if (result) console.log('StatusesPopup:', result) })
}}
>
diff --git a/plugins/workbench-resources/src/components/StatusesPopup.svelte b/plugins/workbench-resources/src/components/StatusesPopup.svelte
index e381dd6513..f30712508f 100644
--- a/plugins/workbench-resources/src/components/StatusesPopup.svelte
+++ b/plugins/workbench-resources/src/components/StatusesPopup.svelte
@@ -19,10 +19,13 @@
import { createEventDispatcher } from 'svelte'
import { Label, showPopup } from '@anticrm/ui'
import { getClient, MessageBox } from '@anticrm/presentation'
+ import type { Kanban } from '@anticrm/view'
import Delete from './icons/Delete.svelte'
import workbench from '@anticrm/workbench'
+ import view from '@anticrm/view'
+ export let kanban: Kanban
export let state: State
export let spaceClass: Ref>
@@ -32,8 +35,8 @@
async function deleteState() {
const spaceClassInstance = client.getHierarchy().getClass(spaceClass)
- const view = client.getHierarchy().as(spaceClassInstance, workbench.mixin.SpaceView)
- const containingClass = view.view.class
+ const spaceView = client.getHierarchy().as(spaceClassInstance, workbench.mixin.SpaceView)
+ const containingClass = spaceView.view.class
const objectsInThisState = await client.findAll(containingClass, { state: state._id })
@@ -46,8 +49,9 @@
showPopup(MessageBox, {
label: 'Delete status',
message: 'Do you want to delete this status?'
- }, undefined, (result) => {
+ }, undefined, async (result) => {
if (result) {
+ await client.updateDoc(view.class.Kanban, kanban.space, kanban._id, { $pull: { states: state._id } })
client.removeDoc(state._class, state.space, state._id)
}
})