From e55317ec43c1db7f0ede22245c1655b8dcd00b16 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 5 Aug 2019 13:31:56 +0200 Subject: [PATCH] Clone existing template BUG fixed --- client/src/templates/CUD.js | 6 ++++-- server/models/templates.js | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/client/src/templates/CUD.js b/client/src/templates/CUD.js index 39bab165..b253f129 100644 --- a/client/src/templates/CUD.js +++ b/client/src/templates/CUD.js @@ -152,8 +152,10 @@ export default class CUD extends Component { } const typeKey = state.getIn(['type', 'value']); - if (!typeKey) { + if (!typeKey && !state.getIn(['fromExistingEntity', 'value'])) { state.setIn(['type', 'error'], t('typeMustBeSelected')); + }else{ + state.setIn(['type', 'error'], null); } if (!state.getIn(['tag_language', 'value'])) { @@ -168,7 +170,7 @@ export default class CUD extends Component { validateNamespace(t, state); - if (typeKey) { + if (typeKey && !state.getIn(['fromExistingEntity', 'value'])) { this.templateTypes[typeKey].validate(state); } } diff --git a/server/models/templates.js b/server/models/templates.js index 68d34c28..5a278a7d 100644 --- a/server/models/templates.js +++ b/server/models/templates.js @@ -92,12 +92,13 @@ async function create(context, entity) { await shares.rebuildPermissionsTx(tx, { entityTypeId: 'template', entityId: id }); - if (entity.fromExistingEntity) { + //Returns an error + /*if (entity.fromExistingEntity) { await files.copyAllTx(tx, context, 'template', 'file', entity.existingEntity, 'template', 'file', id); convertFileURLs(entity, 'template', entity.existingEntity, 'template', id); await tx('templates').update(filterObject(entity, allowedKeys)).where('id', id); - } + }*/ return id; });