Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[star-rating] Fixed: Cannot parse JSON value in targeting.steps #5875

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading