mirror of
https://github.com/strapi/strapi.git
synced 2025-08-06 15:53:11 +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 {
|
||||
await apiHandler.clear(uid);
|
||||
|
||||
// generate new api squeleton
|
||||
// generate new api skeleton
|
||||
await generateAPI({
|
||||
name: updatedContentType.schema.info.name,
|
||||
kind: updatedContentType.schema.kind,
|
||||
|
@ -93,7 +93,7 @@ function createSchemaBuilder({ components, contentTypes }) {
|
||||
via,
|
||||
allowedTypes: attribute.allowedTypes,
|
||||
plugin: 'upload',
|
||||
required: attribute.required ? true : false,
|
||||
required: !!attribute.required,
|
||||
configurable: configurable === false ? false : undefined,
|
||||
};
|
||||
} else {
|
||||
|
@ -51,6 +51,10 @@ module.exports = function createSchemaHandler(infos) {
|
||||
return state.uid;
|
||||
},
|
||||
|
||||
get writable() {
|
||||
return _.get(state, 'plugin') !== 'admin';
|
||||
},
|
||||
|
||||
setUID(val) {
|
||||
modified = true;
|
||||
|
||||
@ -201,6 +205,10 @@ module.exports = function createSchemaHandler(infos) {
|
||||
|
||||
// save the schema to disk
|
||||
async flush() {
|
||||
if (!this.writable) {
|
||||
return;
|
||||
}
|
||||
|
||||
const initialPath = path.join(initialState.dir, initialState.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
|
||||
async rollback() {
|
||||
if (!this.writable) {
|
||||
return;
|
||||
}
|
||||
|
||||
const initialPath = path.join(initialState.dir, initialState.filename);
|
||||
const filePath = path.join(state.dir, state.filename);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user