[MM-43785] Hide insights feature intro for new users (#20214)

* tools updates

* Revert "tools updates"

This reverts commit 6293297b55803c5a263e200ebd80192899666ae9.

* hide insights modal by default for new users

* updating feature flag for test

* updating preference tests

* fixing lint

* fixing comment

Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.local>
Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MBP.ht.home>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Ben Cooke
2022-06-08 14:56:34 -04:00
коммит произвёл GitHub
родитель 719e4504b8
Коммит 2c63e8dd08
5 изменённых файлов: 93 добавлений и 34 удалений

Просмотреть файл

@@ -273,7 +273,17 @@ func (a *App) createUserOrGuest(c *request.Context, user *model.User, guest bool
recommendedNextStepsPref := model.Preference{UserId: ruser.Id, Category: model.PreferenceRecommendedNextSteps, Name: "hide", Value: "false"}
tutorialStepPref := model.Preference{UserId: ruser.Id, Category: model.PreferenceCategoryTutorialSteps, Name: ruser.Id, Value: "0"}
if err := a.Srv().Store.Preference().Save(model.Preferences{recommendedNextStepsPref, tutorialStepPref}); err != nil {
preferences := model.Preferences{recommendedNextStepsPref, tutorialStepPref}
if a.Config().FeatureFlags.InsightsEnabled {
// We don't want to show the insights intro modal for new users
preferences = append(preferences, model.Preference{UserId: ruser.Id, Category: model.PreferenceCategoryInsights, Name: model.PreferenceNameInsights, Value: "{\"insights_modal_viewed\":true}"})
} else {
preferences = append(preferences, model.Preference{UserId: ruser.Id, Category: model.PreferenceCategoryInsights, Name: model.PreferenceNameInsights, Value: "{\"insights_modal_viewed\":false}"})
}
if err := a.Srv().Store.Preference().Save(preferences); err != nil {
mlog.Warn("Encountered error saving user preferences", mlog.Err(err))
}