-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat(surveys): auto opt in and out surveys for users #18080
Conversation
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This toggle updating should be in the backend, which will make sure we cover all paths much more easily. Only where the user themselves can change things should we use updateCurrentTeam
in the frontend.
…sthog into remove-surveys-toggle
Fixed the flicker Screen.Recording.2023-10-19.at.4.20.21.PM.mov |
@@ -33,7 +34,8 @@ interface SurveysCreators { | |||
export const surveysLogic = kea<surveysLogicType>([ | |||
path(['scenes', 'surveys', 'surveysLogic']), | |||
connect(() => ({ | |||
values: [userLogic, ['user']], | |||
values: [userLogic, ['user'], teamLogic, ['currentTeam', 'currentTeamLoading']], | |||
actions: [teamLogic, ['loadCurrentTeam']], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're reloading current team to get the most up to date surveys_opt_in
value since it's being triggered in the backend now.
}, | ||
setSurveysFilters: () => { | ||
actions.loadSurveys() | ||
actions.loadResponsesCount() | ||
}, | ||
loadSurveysSuccess: () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
surveyLogic
calls loadSurveys
when surveys are launched/updated/resumed, so this should cover team reloading for all those cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
* opt in surveys when creating survey and opt out when no active surveys * update survey banner warning * add auto opt ins for surveys list launch and stop surveys * remove from onboarding step * Update UI snapshots for `chromium` (2) * update opt in from backend instead * add filter for api surveys and post delete to receiver * Update query snapshots * fix popup flicker * ambr snapshots * disabled popup banner rename * exclude api surveys in query instead --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* opt in surveys when creating survey and opt out when no active surveys * update survey banner warning * add auto opt ins for surveys list launch and stop surveys * remove from onboarding step * Update UI snapshots for `chromium` (2) * update opt in from backend instead * add filter for api surveys and post delete to receiver * Update query snapshots * fix popup flicker * ambr snapshots * disabled popup banner rename * exclude api surveys in query instead --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Problem
There's pretty much no reason a user needs to manually toggle surveys functionality themselves if they want to use surveys, so we should just make it work out of the box.
Changes
Whenever a user launches a survey, we toggle the surveys script automatically for them. If they stop a survey and there are no other active surveys, we toggle the script off automatically for them.
There is still a manual option for updating the surveys toggle in
Project Settings
if the user needs to for whatever reason.A banner will also display if the user has active surveys but their toggle is turned off
Screen.Recording.2023-10-18.at.10.07.41.PM.mov
👉 Stay up-to-date with PostHog coding conventions for a smoother review.
How did you test this code?