From a5aed8b20cdfc9900f2b2157bd06bc2a0ee2242e Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Wed, 2 Sep 2020 21:15:03 -0700 Subject: [PATCH] Add global urls to transactional email mergeTags --- server/routes/api.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/routes/api.js b/server/routes/api.js index aac6c2a4..aa53d4c2 100644 --- a/server/routes/api.js +++ b/server/routes/api.js @@ -18,6 +18,8 @@ const slugify = require('slugify'); const passport = require('../lib/passport'); const templates = require('../models/templates'); const campaigns = require('../models/campaigns'); +const urls = require('../lib/urls') +const { getMergeTagsForBases } = require('../../shared/templates') const {castToInteger} = require('../lib/helpers'); const {getSystemSendConfigurationId} = require('../../shared/send-configurations'); @@ -362,7 +364,9 @@ router.postAsync('/templates/:templateId/send', async (req, res) => { } const emails = input.EMAIL.split(','); - const mergeTags = input.TAGS || {}; + const mergeTagsGlobal = getMergeTagsForBases(urls.getTrustedUrl(), urls.getSandboxUrl(), urls.getPublicUrl()); + const mergeTagsLocal = input.TAGS || {}; + const mergeTags = { ...mergeTagsGlobal, ...mergeTagsLocal} const subject = input.SUBJECT || ''; const attachments = input.ATTACHMENTS || [];