Skip to content

Commit

Permalink
Merge pull request #5875 from Countly/SER-2212-undefined-value-as-tar…
Browse files Browse the repository at this point in the history
…get-steps-while-editing-a-rating-widget

[star-rating] Fixed: Cannot parse JSON value in targeting.steps
  • Loading branch information
ArtursKadikis authored Dec 20, 2024
2 parents d57b34b + 373e828 commit fcee762
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion plugins/star-rating/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -722,9 +722,15 @@ function uploadFile(myfile, id, callback) {
if (!changes.targeting) {
changes.targeting = {};
}
if (!changes.targeting.user_segmentation) {
changes.targeting.user_segmentation = '{"query":{},"queryText":""}';
}
if (!changes.targeting.steps) {
changes.targeting.steps = '[]';
}
changes.targeting.app_id = params.app_id + "";//has to be string
// eslint-disable-next-line
createCohort(params, type, widgetId, changes.targeting, function(cohortId) { //create cohort using this
createCohort(params, type, widgetId, changes.targeting, function(cohortId) { //create cohort using this
if (cohortId) {
//update widget record to have this cohortId
common.db.collection("feedback_widgets").findAndModify({ "_id": widgetId }, {}, { $set: { "cohortID": cohortId } }, function(/*err, widget*/) {
Expand Down

0 comments on commit fcee762

Please sign in to comment.