Merge branch 'pull/651' into development
This commit is contained in:
commit
5cae9c849c
4 changed files with 9 additions and 9 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
function convertFileURLs(sourceCustom, fromEntityType, fromEntityId, toEntityType, toEntityId) {
|
||||
function convertFileURLs(sourceCustom, fromEntityType, fromEntityId, toEntityType, toEntityId, campaign) {
|
||||
|
||||
function convertText(text) {
|
||||
if (text) {
|
||||
|
@ -22,7 +22,7 @@ function convertFileURLs(sourceCustom, fromEntityType, fromEntityId, toEntityTyp
|
|||
sourceCustom.html = convertText(sourceCustom.html);
|
||||
sourceCustom.text = convertText(sourceCustom.text);
|
||||
|
||||
if (sourceCustom.type === 'mosaico' || sourceCustom.type === 'mosaicoWithFsTemplate') {
|
||||
if ((sourceCustom.type === 'mosaico' || sourceCustom.type === 'mosaicoWithFsTemplate') && campaign){
|
||||
sourceCustom.data.model = convertText(sourceCustom.data.model);
|
||||
sourceCustom.data.model = convertText(sourceCustom.data.model);
|
||||
sourceCustom.data.metadata = convertText(sourceCustom.data.metadata);
|
||||
|
|
|
@ -529,8 +529,7 @@ async function _createTx(tx, context, entity, content) {
|
|||
|
||||
if (copyFilesFrom) {
|
||||
await files.copyAllTx(tx, context, copyFilesFrom.entityType, 'file', copyFilesFrom.entityId, 'campaign', 'file', id);
|
||||
|
||||
convertFileURLs(data.sourceCustom, copyFilesFrom.entityType, copyFilesFrom.entityId, 'campaign', id);
|
||||
convertFileURLs(data.sourceCustom, copyFilesFrom.entityType, copyFilesFrom.entityId, 'campaign', id, true);
|
||||
await tx('campaigns')
|
||||
.update({
|
||||
data: JSON.stringify(data)
|
||||
|
|
|
@ -94,8 +94,7 @@ async function create(context, entity) {
|
|||
|
||||
if (entity.fromExistingEntity) {
|
||||
await files.copyAllTx(tx, context, 'template', 'file', entity.existingEntity, 'template', 'file', id);
|
||||
|
||||
convertFileURLs(entity, 'template', entity.existingEntity, 'template', id);
|
||||
convertFileURLs(entity, 'template', entity.existingEntity, 'template', id, false);
|
||||
await tx('templates').update(filterObject(entity, allowedKeys)).where('id', id);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue