From c4bf0cdb67adec986f03e5039ce4400b80df20ef Mon Sep 17 00:00:00 2001 From: Alexandre Bodin Date: Thu, 12 Mar 2020 09:44:04 +0100 Subject: [PATCH] Add allowedTypes in media type meta Signed-off-by: Alexandre Bodin --- .../services/ContentTypes.js | 1 + .../utils/attributes.js | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/strapi-plugin-content-manager/services/ContentTypes.js b/packages/strapi-plugin-content-manager/services/ContentTypes.js index 5caee17eef..c00286fdd4 100644 --- a/packages/strapi-plugin-content-manager/services/ContentTypes.js +++ b/packages/strapi-plugin-content-manager/services/ContentTypes.js @@ -86,6 +86,7 @@ const formatAttribute = (key, attribute, { model }) => { type: 'media', multiple: attribute.collection ? true : false, required: attribute.required ? true : false, + allowedTypes: attribute.allowedTypes, }; } else { return { diff --git a/packages/strapi-plugin-content-type-builder/utils/attributes.js b/packages/strapi-plugin-content-type-builder/utils/attributes.js index d28a6a4a32..9b183487eb 100644 --- a/packages/strapi-plugin-content-type-builder/utils/attributes.js +++ b/packages/strapi-plugin-content-type-builder/utils/attributes.js @@ -29,9 +29,7 @@ const hasComponent = model => { const isConfigurable = attribute => _.get(attribute, 'configurable', true); const isRelation = attribute => - _.has(attribute, 'target') || - _.has(attribute, 'model') || - _.has(attribute, 'collection'); + _.has(attribute, 'target') || _.has(attribute, 'model') || _.has(attribute, 'collection'); /** * Formats a component's attributes @@ -57,9 +55,7 @@ const formatAttribute = (key, attribute, { model }) => { if (_.has(attribute, 'type')) return attribute; // format relations - const relation = (model.associations || []).find( - assoc => assoc.alias === key - ); + const relation = (model.associations || []).find(assoc => assoc.alias === key); const { plugin, configurable } = attribute; let targetEntity = attribute.model || attribute.collection; @@ -69,6 +65,7 @@ const formatAttribute = (key, attribute, { model }) => { multiple: attribute.collection ? true : false, required: attribute.required ? true : false, configurable: configurable === false ? false : undefined, + allowedTypes: attribute.allowedTypes, }; } else { return {