Skip to content

Commit

Permalink
fix(surveys): delete targeting_flag_filters field after setting targe…
Browse files Browse the repository at this point in the history
…ting flag (#17664)
  • Loading branch information
jurajmajerik authored Sep 28, 2023
1 parent 3678ae4 commit 082e406
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions posthog/api/survey.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ def create(self, validated_data):
validated_data["targeting_flag_id"] = targeting_feature_flag.id
validated_data.pop("targeting_flag_filters")

if "targeting_flag_filters" in validated_data:
validated_data.pop("targeting_flag_filters")

validated_data["created_by"] = self.context["request"].user
return super().create(validated_data)

Expand Down
1 change: 1 addition & 0 deletions posthog/api/test/test_survey.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def test_can_create_basic_survey(self):
"description": "Get feedback on the new notebooks feature",
"type": "popover",
"questions": [{"type": "open", "question": "What do you think of the new notebooks feature?"}],
"targeting_flag_filters": None,
},
format="json",
)
Expand Down

0 comments on commit 082e406

Please sign in to comment.