mirror of
https://github.com/strapi/strapi.git
synced 2025-08-08 00:37:38 +00:00
Fix unwanted extension folder creation for admin schemas
Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>
This commit is contained in:
parent
a5cd2fe6d1
commit
d1b543f5cf
@ -174,7 +174,7 @@ const editContentType = async (uid, { contentType, components = [] }) => {
|
|||||||
try {
|
try {
|
||||||
await apiHandler.clear(uid);
|
await apiHandler.clear(uid);
|
||||||
|
|
||||||
// generate new api squeleton
|
// generate new api skeleton
|
||||||
await generateAPI({
|
await generateAPI({
|
||||||
name: updatedContentType.schema.info.name,
|
name: updatedContentType.schema.info.name,
|
||||||
kind: updatedContentType.schema.kind,
|
kind: updatedContentType.schema.kind,
|
||||||
|
@ -93,7 +93,7 @@ function createSchemaBuilder({ components, contentTypes }) {
|
|||||||
via,
|
via,
|
||||||
allowedTypes: attribute.allowedTypes,
|
allowedTypes: attribute.allowedTypes,
|
||||||
plugin: 'upload',
|
plugin: 'upload',
|
||||||
required: attribute.required ? true : false,
|
required: !!attribute.required,
|
||||||
configurable: configurable === false ? false : undefined,
|
configurable: configurable === false ? false : undefined,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
@ -51,6 +51,10 @@ module.exports = function createSchemaHandler(infos) {
|
|||||||
return state.uid;
|
return state.uid;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
get writable() {
|
||||||
|
return _.get(state, 'plugin') !== 'admin';
|
||||||
|
},
|
||||||
|
|
||||||
setUID(val) {
|
setUID(val) {
|
||||||
modified = true;
|
modified = true;
|
||||||
|
|
||||||
@ -201,6 +205,10 @@ module.exports = function createSchemaHandler(infos) {
|
|||||||
|
|
||||||
// save the schema to disk
|
// save the schema to disk
|
||||||
async flush() {
|
async flush() {
|
||||||
|
if (!this.writable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const initialPath = path.join(initialState.dir, initialState.filename);
|
const initialPath = path.join(initialState.dir, initialState.filename);
|
||||||
const filePath = path.join(state.dir, state.filename);
|
const filePath = path.join(state.dir, state.filename);
|
||||||
|
|
||||||
@ -244,6 +252,10 @@ module.exports = function createSchemaHandler(infos) {
|
|||||||
|
|
||||||
// reset the schema to its initial value
|
// reset the schema to its initial value
|
||||||
async rollback() {
|
async rollback() {
|
||||||
|
if (!this.writable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const initialPath = path.join(initialState.dir, initialState.filename);
|
const initialPath = path.join(initialState.dir, initialState.filename);
|
||||||
const filePath = path.join(state.dir, state.filename);
|
const filePath = path.join(state.dir, state.filename);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user