MM-45204: Enables Insights feature flag by default. (#20509)

* MM-45204: Enables Insights feature flag by default.

* MM-45204: Update test.
Этот коммит содержится в:
Martin Kraft
2022-07-05 09:16:44 -04:00
коммит произвёл GitHub
родитель 9cbe7dac09
Коммит b99bd0d049
7 изменённых файлов: 10 добавлений и 52 удалений

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

@@ -19,9 +19,6 @@ func TestGetTopReactionsForTeamSince(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
th.ConfigStore.SetReadOnlyFF(false)
defer th.ConfigStore.SetReadOnlyFF(true)
th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true })
th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuProfessional))
client := th.Client
@@ -245,9 +242,6 @@ func TestGetTopReactionsForUserSince(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
th.ConfigStore.SetReadOnlyFF(false)
defer th.ConfigStore.SetReadOnlyFF(true)
th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true })
th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuProfessional))
client := th.Client
@@ -437,9 +431,6 @@ func TestGetTopChannelsForTeamSince(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
th.ConfigStore.SetReadOnlyFF(false)
defer th.ConfigStore.SetReadOnlyFF(true)
th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true })
th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuProfessional))
client := th.Client
@@ -536,9 +527,6 @@ func TestGetTopChannelsForUserSince(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
th.ConfigStore.SetReadOnlyFF(false)
defer th.ConfigStore.SetReadOnlyFF(true)
th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true })
th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuProfessional))
client := th.Client
@@ -617,10 +605,6 @@ func TestGetTopThreadsForTeamSince(t *testing.T) {
defer th.TearDown()
th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuProfessional))
th.ConfigStore.SetReadOnlyFF(false)
defer th.ConfigStore.SetReadOnlyFF(true)
th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true })
th.LoginBasic()
client := th.Client
@@ -707,10 +691,6 @@ func TestGetTopThreadsForUserSince(t *testing.T) {
defer th.TearDown()
th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuProfessional))
th.ConfigStore.SetReadOnlyFF(false)
defer th.ConfigStore.SetReadOnlyFF(true)
th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true })
th.LoginBasic()
client := th.Client

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

@@ -2381,10 +2381,6 @@ func TestGetTopChannelsForTeamSince(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
th.Server.configStore.SetReadOnlyFF(false)
defer th.Server.configStore.SetReadOnlyFF(true)
th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true })
channel2 := th.CreateChannel(th.BasicTeam)
channel3 := th.CreatePrivateChannel(th.BasicTeam)
channel4 := th.CreatePrivateChannel(th.BasicTeam)
@@ -2439,10 +2435,6 @@ func TestGetTopChannelsForUserSince(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
th.Server.configStore.SetReadOnlyFF(false)
defer th.Server.configStore.SetReadOnlyFF(true)
th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true })
channel2 := th.CreateChannel(th.BasicTeam)
channel3 := th.CreatePrivateChannel(th.BasicTeam)
channel4 := th.CreatePrivateChannel(th.BasicTeam)
@@ -2497,10 +2489,6 @@ func TestPostCountsByDuration(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
th.Server.configStore.SetReadOnlyFF(false)
defer th.Server.configStore.SetReadOnlyFF(true)
th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true })
channel2 := th.CreateChannel(th.BasicTeam)
channel3 := th.CreatePrivateChannel(th.BasicTeam)
channel4 := th.CreatePrivateChannel(th.BasicTeam)

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

@@ -182,7 +182,7 @@ func TestPluginAPIGetUserPreferences(t *testing.T) {
assert.Equal(t, user1.Id, preferences[0].UserId)
assert.Equal(t, model.PreferenceCategoryInsights, preferences[0].Category)
assert.Equal(t, model.PreferenceNameInsights, preferences[0].Name)
assert.Equal(t, "{\"insights_modal_viewed\":false}", preferences[0].Value)
assert.Equal(t, "{\"insights_modal_viewed\":true}", preferences[0].Value)
assert.Equal(t, user1.Id, preferences[1].UserId)
assert.Equal(t, model.PreferenceRecommendedNextSteps, preferences[1].Category)
@@ -269,7 +269,7 @@ func TestPluginAPIUpdateUserPreferences(t *testing.T) {
assert.Equal(t, user1.Id, preferences[0].UserId)
assert.Equal(t, model.PreferenceCategoryInsights, preferences[0].Category)
assert.Equal(t, model.PreferenceNameInsights, preferences[0].Name)
assert.Equal(t, "{\"insights_modal_viewed\":false}", preferences[0].Value)
assert.Equal(t, "{\"insights_modal_viewed\":true}", preferences[0].Value)
assert.Equal(t, user1.Id, preferences[1].UserId)
assert.Equal(t, model.PreferenceRecommendedNextSteps, preferences[1].Category)

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

@@ -2822,10 +2822,6 @@ func TestGetTopThreadsForTeamSince(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
th.Server.configStore.SetReadOnlyFF(false)
defer th.Server.configStore.SetReadOnlyFF(true)
th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true })
// create a public channel, a private channel
channelPublic := th.CreateChannel(th.BasicTeam)
channelPrivate := th.CreatePrivateChannel(th.BasicTeam)
@@ -2898,10 +2894,6 @@ func TestGetTopThreadsForUserSince(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
th.Server.configStore.SetReadOnlyFF(false)
defer th.Server.configStore.SetReadOnlyFF(true)
th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true })
// create a public channel, a private channel
channelPublic := th.CreateChannel(th.BasicTeam)
channelPrivate := th.CreatePrivateChannel(th.BasicTeam)

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

@@ -92,7 +92,6 @@ func TestGetTopReactionsForTeamSince(t *testing.T) {
th.Server.configStore.SetReadOnlyFF(false)
defer th.Server.configStore.SetReadOnlyFF(true)
th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true })
userId := th.BasicUser.Id
user2Id := th.BasicUser2.Id
@@ -252,6 +251,7 @@ func TestGetTopReactionsForTeamSince(t *testing.T) {
t.Run("get-top-reactions-for-team-since feature flag", func(t *testing.T) {
th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = false })
defer th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true })
_, err := th.App.GetTopReactionsForTeamSince(userId, teamId, &model.InsightsOpts{StartUnixMilli: timeRange.UnixMilli(), Page: 0, PerPage: 5})
assert.NotNil(t, err)
})
@@ -263,7 +263,6 @@ func TestGetTopReactionsForUserSince(t *testing.T) {
th.Server.configStore.SetReadOnlyFF(false)
defer th.Server.configStore.SetReadOnlyFF(true)
th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true })
userId := th.BasicUser.Id
@@ -423,6 +422,7 @@ func TestGetTopReactionsForUserSince(t *testing.T) {
t.Run("get-top-reactions-for-user-since feature flag", func(t *testing.T) {
th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = false })
defer th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true })
_, err := th.App.GetTopReactionsForUserSince(userId, teamId, &model.InsightsOpts{StartUnixMilli: timeRange.UnixMilli(), Page: 0, PerPage: 5})
assert.NotNil(t, err)
})

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

@@ -254,16 +254,16 @@ func TestCreateUser(t *testing.T) {
[]string{
`
package main
import (
"github.com/mattermost/mattermost-server/v6/plugin"
"github.com/mattermost/mattermost-server/v6/model"
)
type MyPlugin struct {
plugin.MattermostPlugin
}
func (p *MyPlugin) UserHasBeenCreated(c *plugin.Context, user *model.User) {
user.Nickname = "sanitized"
if len(user.Password) > 0 {
@@ -271,7 +271,7 @@ func TestCreateUser(t *testing.T) {
}
p.API.UpdateUser(user)
}
func main() {
plugin.ClientMain(&MyPlugin{})
}
@@ -1729,9 +1729,6 @@ func TestCreateUserWithInitialPreferences(t *testing.T) {
defer th.TearDown()
t.Run("successfully create a user with initial tutorial and recommended steps preferences", func(t *testing.T) {
th.Server.configStore.SetReadOnlyFF(false)
defer th.Server.configStore.SetReadOnlyFF(true)
th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true })
testUser := th.CreateUser()
defer th.App.PermanentDeleteUser(th.Context, testUser)
@@ -1755,6 +1752,7 @@ func TestCreateUserWithInitialPreferences(t *testing.T) {
th.Server.configStore.SetReadOnlyFF(false)
defer th.Server.configStore.SetReadOnlyFF(true)
th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = false })
defer th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true })
testUser := th.CreateUser()
defer th.App.PermanentDeleteUser(th.Context, testUser)

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

@@ -92,7 +92,7 @@ func (f *FeatureFlags) SetDefaults() {
f.EnableInactivityCheckJob = true
f.UseCaseOnboarding = true
f.GraphQL = false
f.InsightsEnabled = false
f.InsightsEnabled = true
f.CommandPalette = false
f.AdvancedTextEditor = true
f.CallsEnabled = true