Some bugfixes
This commit is contained in:
parent
a3983193d3
commit
8683f8c91e
6 changed files with 12 additions and 8 deletions
|
@ -478,7 +478,7 @@ async function remove(context, id) {
|
|||
await triggers.removeAllByCampaignIdTx(tx, context, id);
|
||||
|
||||
await tx('template_dep_campaigns')
|
||||
.where('campaign', entity.id)
|
||||
.where('campaign', id)
|
||||
.del();
|
||||
|
||||
await tx('campaigns').where('id', id).del();
|
||||
|
|
|
@ -146,11 +146,11 @@ async function updateLinks(campaign, list, subscription, mergeTags, message) {
|
|||
}
|
||||
|
||||
if (!campaign.click_tracking_disabled) {
|
||||
const re = /(<a[^>]* href\s*=[\s"']*)(http[^"'>\s]+)/gi;
|
||||
const re = /(<a[^>]* href\s*=\s*["']\s*)(http[^"'>\s]+)/gi;
|
||||
|
||||
const urlsToBeReplaced = new Set();
|
||||
|
||||
message = message.replace(re, (match, prefix, encodedUrl) => {
|
||||
message.replace(re, (match, prefix, encodedUrl) => {
|
||||
const url = he.decode(encodedUrl, {isAttributeValue: true});
|
||||
urlsToBeReplaced.add(url);
|
||||
});
|
||||
|
@ -166,7 +166,7 @@ async function updateLinks(campaign, list, subscription, mergeTags, message) {
|
|||
message = message.replace(re, (match, prefix, encodedUrl) => {
|
||||
const url = he.decode(encodedUrl, {isAttributeValue: true});
|
||||
const link = urls.get(url);
|
||||
return getPublicUrl(`/links/${campaign.cid}/${list.cid}/${subscription.cid}/${link.cid}`);
|
||||
return prefix + (link ? getPublicUrl(`/links/${campaign.cid}/${list.cid}/${subscription.cid}/${link.cid}`) : url);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue