From 53537a221a7dfac45bc15a2d3db938e5fb503120 Mon Sep 17 00:00:00 2001 From: Vivek Kekuda Date: Wed, 14 Sep 2022 15:56:29 +0530 Subject: [PATCH] Fix resource selection during campaign copy (#2482) Clear the selection of resource (template, page, profile) whenever the original resource is deleted and there is only one currently available resource present in the DB while copying a campaign. Without this fix, the only available resource is shown as the original resource, instead of showing [Deleted]. --- static/js/src/app/campaigns.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/static/js/src/app/campaigns.js b/static/js/src/app/campaigns.js index e98d8bd8..8a72e70c 100644 --- a/static/js/src/app/campaigns.js +++ b/static/js/src/app/campaigns.js @@ -257,6 +257,7 @@ function copy(idx) { .success(function (campaign) { $("#name").val("Copy of " + campaign.name) if (!campaign.template.id) { + $("#template").val("").change(); $("#template").select2({ placeholder: campaign.template.name }); @@ -265,6 +266,7 @@ function copy(idx) { $("#template").trigger("change.select2") } if (!campaign.page.id) { + $("#page").val("").change(); $("#page").select2({ placeholder: campaign.page.name }); @@ -273,6 +275,7 @@ function copy(idx) { $("#page").trigger("change.select2") } if (!campaign.smtp.id) { + $("#profile").val("").change(); $("#profile").select2({ placeholder: campaign.smtp.name });