Skip to content

Save onboarding survey response to user preferences#28530

Merged
michellescripts merged 1 commit intomasterfrom
michelle/onboard-user-preferences
Jul 3, 2023
Merged

Save onboarding survey response to user preferences#28530
michellescripts merged 1 commit intomasterfrom
michelle/onboard-user-preferences

Conversation

@michellescripts
Copy link
Copy Markdown
Contributor

@michellescripts michellescripts commented Jun 30, 2023

This PR adds an onboard object to the user preferences cluster state. For now, this is leveraged by the onboarding questionnaire to save the "preferred resources" answer.

This also fixes a few minor issues: it does not allow us to overwrite DefaultUserPreferences; mocks useUser in UI tests and adds an optional decorator to Storybook if args: { userContext: true } is present on the story.

The onboarding questionnaire will not be integrated into onboarding flow as part of this PR, that will follow in #28119 (no user change with merge). I will also handle outstanding user permissions issues in that PR (currently 403s/pre-session).

@michellescripts michellescripts force-pushed the michelle/onboard-user-preferences branch 6 times, most recently from d0d88b3 to 52bf4a4 Compare June 30, 2023 17:44
@michellescripts michellescripts marked this pull request as ready for review June 30, 2023 20:06
@github-actions github-actions Bot requested a review from avatus June 30, 2023 20:07
@michellescripts michellescripts force-pushed the michelle/onboard-user-preferences branch from 52bf4a4 to 7dba6a4 Compare June 30, 2023 20:08
@michellescripts michellescripts removed the request for review from avatus June 30, 2023 20:09
@michellescripts michellescripts requested a review from kimlisa July 3, 2023 14:57
Comment thread lib/services/local/userpreferences.go Outdated
@michellescripts michellescripts force-pushed the michelle/onboard-user-preferences branch 5 times, most recently from 5b4a481 to 75ea1f5 Compare July 3, 2023 17:15
@michellescripts michellescripts enabled auto-merge July 3, 2023 17:15
@michellescripts michellescripts disabled auto-merge July 3, 2023 17:20
@michellescripts michellescripts force-pushed the michelle/onboard-user-preferences branch from 75ea1f5 to b803712 Compare July 3, 2023 17:25
@michellescripts michellescripts enabled auto-merge July 3, 2023 17:25
@michellescripts michellescripts added this pull request to the merge queue Jul 3, 2023
Merged via the queue into master with commit 79754a3 Jul 3, 2023
@michellescripts michellescripts deleted the michelle/onboard-user-preferences branch July 3, 2023 18:01
@public-teleport-github-review-bot
Copy link
Copy Markdown

@michellescripts See the table below for backport results.

Branch Result
branch/v13 Failed

@michellescripts
Copy link
Copy Markdown
Contributor Author

Backport with fix to #28740

github-merge-queue Bot pushed a commit that referenced this pull request Jul 21, 2023
* Add onboarding questionnaire components (#27977)

* Posthog event for onboarding questionnaire submit (#28328)

* update protos

* create Posthog event for onboarding questionnaire submit

* set onboarding survey on user preferences (#28530)

* Fix panic when fetching user preferences (#28751)

* Fix panic when fetching user preferences

Closes #28740

* Prevent overwriting mismatched types in user preferences

* Add error handling to user preferences service

* GCI imports

* Refactor user preferences test and logic

This commit updates the approach for comparing equality in user preferences test. It introduces the use of the "go-cmp" library which provides more flexibility in handling comparison of struct elements, thus helping to catch any unexpected changes that could be overlooked with the standard equality checking. We also revised the logic to handle default preferences by overwriting values for better efficiency and readability, also removing unnecessary checking and merging of values.

* Add comments to overwriteValues method in userpreferences.go

Added detailed comments to better explain the overwriteValues function in userpreferences.go file. The comments clarify how the function uses proto.Ranges to iterate over fields and only overwrite non-nil/empty fields.

* Apply some magic to preferences test

* Change the import to avoid go.mod changed and match our other imports

* Onboarding changes to support e survey (#28981)

* Display a survey during onboarding

- Adds user context wrapper to the Welcome flow in order to update preferences
- Sets selected resources on user preferences

* imports & describes

* named enums

* remove onboard survey from oss

- will be moved to /e
- export shared types

* refactor welcome

- move new credential to welcome prop

* refactor new credentails

- container passes questionnaire to component

* remove survey ls dispatch

* pr feedback

* Revert "pr feedback"

This reverts commit 060f34fb60242856f233df6a1006c5192ea321fb.

---------

Co-authored-by: Jakub Nyckowski <jakub.nyckowski@goteleport.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants