Skip to content

Commit

Permalink
Merge pull request #5334 from Countly/anna/master
Browse files Browse the repository at this point in the history
[populator] Correctly check if different plugins enabled
  • Loading branch information
Cookiezaurs authored Jun 14, 2024
2 parents 44c579a + 81d086c commit c5ebbd2
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions plugins/populator/frontend/public/javascripts/countly.models.js
Original file line number Diff line number Diff line change
Expand Up @@ -1957,7 +1957,7 @@
* @param {callback} callback - callback method
**/
function generateCampaigns(callback) {
if (typeof countlyAttribution === "undefined") {
if (!CountlyHelpers.isPluginEnabled("attribution") || typeof countlyAttribution === "undefined") {
callback();
return;
}
Expand Down Expand Up @@ -2346,7 +2346,7 @@

var template = this.currentTemplate || {};

if (typeof countlyCohorts !== "undefined" && countlyAuth.validateCreate('cohorts')) {
if (CountlyHelpers.isPluginEnabled("cohorts") && typeof countlyCohorts !== "undefined" && countlyAuth.validateCreate('cohorts')) {
if (template.events && template.events.length) {
var firstEventKey = template.events[getRandomInt(0, template.events.length - 1)].key;

Expand Down Expand Up @@ -2469,7 +2469,7 @@
});
}

if (typeof countlyFunnel !== "undefined" && countlyAuth.validateCreate('funnels')) {
if (CountlyHelpers.isPluginEnabled("funnels") && typeof countlyFunnel !== "undefined" && countlyAuth.validateCreate('funnels')) {

let pages = countlyGlobal.apps[countlyCommon.ACTIVE_APP_ID].type === "mobile" ? viewSegments.name : getPageTemplates(countlyPopulator.getSelectedTemplate().substr(7).toLowerCase());
let page1 = pages[getRandomInt(0, pages.length - 1)];
Expand Down Expand Up @@ -2555,9 +2555,11 @@
});
}

createMessage(messages[0]);
createMessage(messages[1]);
createMessage(messages[2]);
if (CountlyHelpers.isPluginEnabled("push")) {
createMessage(messages[0]);
createMessage(messages[1]);
createMessage(messages[2]);
}
};

countlyPopulator.getSelectedTemplate = function() {
Expand Down

0 comments on commit c5ebbd2

Please sign in to comment.