Skip to content

Commit

Permalink
#58: normalize cross-type references with r__ for automation
Browse files Browse the repository at this point in the history
  • Loading branch information
JoernBerkefeld committed May 17, 2024
1 parent 761add0 commit c6f6dde
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions lib/metadataTypes/Asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ class Asset extends MetadataType {
// get template
try {
if (metadata.views?.html?.template?.id) {
metadata.views.html.template.r__assetTemplate_Key = cache.searchForField(
metadata.views.html.template.r__asset_customerKey = cache.searchForField(
'asset',
metadata.views?.html?.template?.id,
'id',
Expand Down Expand Up @@ -688,18 +688,18 @@ class Asset extends MetadataType {
// template-based emails
if (
metadata.assetType.name === 'templatebasedemail' &&
metadata.views?.html?.template?.r__assetTemplate_Key
metadata.views?.html?.template?.r__asset_customerKey
) {
// template
metadata.views.html.template.id = cache.searchForField(
'asset',
metadata.views.html.template.r__assetTemplate_Key,
metadata.views.html.template.r__asset_customerKey,
'customerKey',
'id'
);
metadata.views.html.template.name = cache.searchForField(
'asset',
metadata.views.html.template.r__assetTemplate_Key,
metadata.views.html.template.r__asset_customerKey,
'customerKey',
'name'
);
Expand All @@ -715,7 +715,7 @@ class Asset extends MetadataType {

metadata.views.html.template.availableViews = [];
metadata.views.html.template.modelVersion = 2;
delete metadata.views.html.template.r__assetTemplate_Key;
delete metadata.views.html.template.r__asset_customerKey;
}

// restore asset type id which is needed for deploy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"availableViews": [],
"template": {
"meta": { "contentHash": -166410261 },
"r__assetTemplate_Key": "testTemplated_asset_template"
"r__asset_customerKey": "testTemplated_asset_template"
},
"data": { "email": { "options": { "generateFrom": null } } },
"modelVersion": 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"availableViews": [],
"template": {
"meta": { "contentHash": -166410261 },
"r__assetTemplate_Key": "testExisting_asset_template"
"r__asset_customerKey": "testExisting_asset_template"
},
"data": { "email": { "options": { "generateFrom": null } } },
"modelVersion": 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"availableViews": [],
"template": {
"meta": { "contentHash": -166410261 },
"r__assetTemplate_Key": "{{{prefix}}}asset_template"
"r__asset_customerKey": "{{{prefix}}}asset_template"
},
"data": { "email": { "options": { "generateFrom": null } } },
"modelVersion": 2
Expand Down

0 comments on commit c6f6dde

Please sign in to comment.