convertFileURLs fix
This commit is contained in:
parent
e55317ec43
commit
b08fd07909
2 changed files with 6 additions and 8 deletions
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function convertFileURLs(sourceCustom, fromEntityType, fromEntityId, toEntityType, toEntityId) {
|
function convertFileURLs(sourceCustom, fromEntityType, fromEntityId, toEntityType, toEntityId, campaign) {
|
||||||
|
|
||||||
function convertText(text) {
|
function convertText(text) {
|
||||||
if (text) {
|
if (text) {
|
||||||
|
@ -22,7 +22,7 @@ function convertFileURLs(sourceCustom, fromEntityType, fromEntityId, toEntityTyp
|
||||||
sourceCustom.html = convertText(sourceCustom.html);
|
sourceCustom.html = convertText(sourceCustom.html);
|
||||||
sourceCustom.text = convertText(sourceCustom.text);
|
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.model = convertText(sourceCustom.data.model);
|
sourceCustom.data.model = convertText(sourceCustom.data.model);
|
||||||
sourceCustom.data.metadata = convertText(sourceCustom.data.metadata);
|
sourceCustom.data.metadata = convertText(sourceCustom.data.metadata);
|
||||||
|
|
|
@ -92,13 +92,11 @@ async function create(context, entity) {
|
||||||
|
|
||||||
await shares.rebuildPermissionsTx(tx, { entityTypeId: 'template', entityId: id });
|
await shares.rebuildPermissionsTx(tx, { entityTypeId: 'template', entityId: id });
|
||||||
|
|
||||||
//Returns an error
|
if (entity.fromExistingEntity) {
|
||||||
/*if (entity.fromExistingEntity) {
|
|
||||||
await files.copyAllTx(tx, context, 'template', 'file', entity.existingEntity, 'template', 'file', id);
|
await files.copyAllTx(tx, context, 'template', 'file', entity.existingEntity, 'template', 'file', id);
|
||||||
|
convertFileURLs(entity, 'template', entity.existingEntity, 'template', id, false);
|
||||||
convertFileURLs(entity, 'template', entity.existingEntity, 'template', id);
|
|
||||||
await tx('templates').update(filterObject(entity, allowedKeys)).where('id', id);
|
await tx('templates').update(filterObject(entity, allowedKeys)).where('id', id);
|
||||||
}*/
|
}
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue