Skip to content

Commit

Permalink
#706: fix broken Asset-TriggeredSend link after rename of TSD to TS
Browse files Browse the repository at this point in the history
  • Loading branch information
JoernBerkefeld committed Mar 24, 2023
1 parent 6d4810e commit ba5d899
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/metadataTypes/Asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ class Asset extends MetadataType {
if (isRefresh) {
if (createdUpdated.updated) {
// only run this if assets were updated. for created assets we do not expect
this._refreshTriggeredSendDefinition(metadata);
this._refreshTriggeredSend(metadata);
} else {
Util.logger.warn(
'You set the --refresh flag but no updated assets found. Skipping refresh of triggeredSendDefinitions.'
Expand All @@ -525,7 +525,7 @@ class Asset extends MetadataType {
* @param {TYPE.MetadataTypeMap} metadata metadata mapped by their keyField
* @returns {Promise.<void>} -
*/
static async _refreshTriggeredSendDefinition(metadata) {
static async _refreshTriggeredSend(metadata) {
// get legacyData.legacyId from assets to compare to TSD's metadata.Email.ID to
const legacyIdArr = Object.keys(metadata)
.map((key) => metadata[key]?.legacyData?.legacyId)
Expand All @@ -538,13 +538,13 @@ class Asset extends MetadataType {
return;
}
// prep triggeredSendDefinition class
const TriggeredSendDefinition = require('./TriggeredSendDefinition');
TriggeredSendDefinition.properties = this.properties;
TriggeredSendDefinition.buObject = this.buObject;
TriggeredSendDefinition.client = this.client;
const TriggeredSend = require('./TriggeredSend');
TriggeredSend.properties = this.properties;
TriggeredSend.buObject = this.buObject;
TriggeredSend.client = this.client;
try {
// find refreshable TSDs
const tsdObj = (await TriggeredSendDefinition.findRefreshableItems()).metadata;
const tsdObj = (await TriggeredSend.findRefreshableItems()).metadata;

const tsdCountInitial = Object.keys(tsdObj).length;
const emailCount = legacyIdArr.length;
Expand All @@ -560,9 +560,9 @@ class Asset extends MetadataType {
);

// get keys of TSDs to refresh
const keyArr = await TriggeredSendDefinition.getKeysForValidTSDs(tsdObj);
const keyArr = await TriggeredSend.getKeysForValidTSDs(tsdObj);

await TriggeredSendDefinition.refresh(keyArr);
await TriggeredSend.refresh(keyArr);
} catch {
Util.logger.warn('Failed to refresh triggeredSendDefinition');
}
Expand Down

0 comments on commit ba5d899

Please sign in to comment.