From 617d835c4f8005f0a47ee881e3db207676d3495b Mon Sep 17 00:00:00 2001 From: Alexey Zinoviev Date: Wed, 12 Jun 2024 19:35:39 +0400 Subject: [PATCH] ezqms-976: exclude other types mixins (#5795) Signed-off-by: Alexey Zinoviev --- .../src/components/product/EditProduct.svelte | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/plugins/products-resources/src/components/product/EditProduct.svelte b/plugins/products-resources/src/components/product/EditProduct.svelte index 4e0949c0b4..c94de36c83 100644 --- a/plugins/products-resources/src/components/product/EditProduct.svelte +++ b/plugins/products-resources/src/components/product/EditProduct.svelte @@ -58,13 +58,6 @@ const notificationClient = getResource(notification.function.GetInboxNotificationsClient).then((res) => res()) const me = getCurrentAccount()._id - // We need to think about this issue and redesign somehow? - const ignoredMixins = [ - core.mixin.SpacesTypeData, - documents.mixin.DocumentSpaceTypeData, - 'training:mixin:TrainingsTypeData' as any - ] - let object: Product | undefined let title = '' let showAllMixins = false @@ -124,7 +117,24 @@ checkMyPermission(core.permission.UpdateObject, core.space.Space, $permissionsStore)) $: descriptionKey = client.getHierarchy().getAttribute(products.class.Product, 'fullDescription') - $: mixins = object !== undefined ? getDocMixins(object, showAllMixins, new Set(ignoredMixins)) : [] + $: otherSpaceTypesMixins = new Set( + object !== undefined + ? client + .getModel() + .findAllSync( + core.class.SpaceType, + { + _id: { $ne: object.type } + }, + { + projection: { targetClass: 1 } + } + ) + ?.map((st) => st.targetClass) ?? [] + : [] + ) + $: mixins = + object !== undefined ? getDocMixins(object, showAllMixins).filter((m) => !otherSpaceTypesMixins.has(m._id)) : [] {#if object !== undefined}