From 00374ae456db7631711e85b330c6afaf0e850fcf Mon Sep 17 00:00:00 2001 From: Harshil Sharma <18575143+harshilsharma63@users.noreply.github.com> Date: Tue, 4 Nov 2025 09:24:49 +0100 Subject: [PATCH] Set feature flag default to true (#34374) --- server/channels/api4/channel_test.go | 5 -- server/channels/api4/content_flagging_test.go | 55 +++---------------- server/channels/api4/team_test.go | 5 -- server/public/model/feature_flags.go | 2 +- 4 files changed, 10 insertions(+), 57 deletions(-) diff --git a/server/channels/api4/channel_test.go b/server/channels/api4/channel_test.go index 343b516dc09..a6edac7b6ed 100644 --- a/server/channels/api4/channel_test.go +++ b/server/channels/api4/channel_test.go @@ -8,7 +8,6 @@ import ( "encoding/json" "fmt" "net/http" - "os" "sort" "strings" "testing" @@ -1633,10 +1632,6 @@ func TestDeleteGroupChannel(t *testing.T) { func TestGetChannel(t *testing.T) { mainHelper.Parallel(t) - os.Setenv("MM_FEATUREFLAGS_ContentFlagging", "true") - defer func() { - os.Unsetenv("MM_FEATUREFLAGS_ContentFlagging") - }() th := Setup(t).InitBasic() defer th.TearDown() diff --git a/server/channels/api4/content_flagging_test.go b/server/channels/api4/content_flagging_test.go index 2cd8a108408..147236f5975 100644 --- a/server/channels/api4/content_flagging_test.go +++ b/server/channels/api4/content_flagging_test.go @@ -6,7 +6,6 @@ package api4 import ( "context" "net/http" - "os" "testing" "github.com/mattermost/mattermost/server/public/model" @@ -33,12 +32,8 @@ func setBasicCommonReviewerConfig(th *TestHelper) *model.AppError { } func TestGetFlaggingConfiguration(t *testing.T) { - os.Setenv("MM_FEATUREFLAGS_ContentFlagging", "true") th := Setup(t) - defer func() { - th.TearDown() - os.Unsetenv("MM_FEATUREFLAGS_ContentFlagging") - }() + defer th.TearDown() client := th.Client @@ -74,12 +69,8 @@ func TestGetFlaggingConfiguration(t *testing.T) { } func TestSaveContentFlaggingSettings(t *testing.T) { - os.Setenv("MM_FEATUREFLAGS_ContentFlagging", "true") th := Setup(t).InitBasic() - defer func() { - th.TearDown() - os.Unsetenv("MM_FEATUREFLAGS_ContentFlagging") - }() + defer th.TearDown() client := th.Client @@ -158,12 +149,8 @@ func TestSaveContentFlaggingSettings(t *testing.T) { } func TestGetContentFlaggingSettings(t *testing.T) { - os.Setenv("MM_FEATUREFLAGS_ContentFlagging", "true") th := Setup(t).InitBasic() - defer func() { - th.TearDown() - os.Unsetenv("MM_FEATUREFLAGS_ContentFlagging") - }() + defer th.TearDown() t.Run("Should return 403 when user does not have manage system permission", func(t *testing.T) { th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuEnterpriseAdvanced)) @@ -201,12 +188,8 @@ func TestGetContentFlaggingSettings(t *testing.T) { } func TestGetPostPropertyValues(t *testing.T) { - os.Setenv("MM_FEATUREFLAGS_ContentFlagging", "true") th := Setup(t).InitBasic() - defer func() { - th.TearDown() - os.Unsetenv("MM_FEATUREFLAGS_ContentFlagging") - }() + defer th.TearDown() client := th.Client @@ -288,12 +271,8 @@ func TestGetPostPropertyValues(t *testing.T) { } func TestGetFlaggedPost(t *testing.T) { - os.Setenv("MM_FEATUREFLAGS_ContentFlagging", "true") th := Setup(t).InitBasic() - defer func() { - th.TearDown() - os.Unsetenv("MM_FEATUREFLAGS_ContentFlagging") - }() + defer th.TearDown() client := th.Client @@ -442,12 +421,8 @@ func TestGetFlaggedPost(t *testing.T) { } func TestFlagPost(t *testing.T) { - os.Setenv("MM_FEATUREFLAGS_ContentFlagging", "true") th := Setup(t).InitBasic() - defer func() { - th.TearDown() - os.Unsetenv("MM_FEATUREFLAGS_ContentFlagging") - }() + defer th.TearDown() client := th.Client @@ -588,12 +563,8 @@ func TestFlagPost(t *testing.T) { } func TestGetTeamPostReportingFeatureStatus(t *testing.T) { - os.Setenv("MM_FEATUREFLAGS_ContentFlagging", "true") th := Setup(t) - defer func() { - th.TearDown() - os.Unsetenv("MM_FEATUREFLAGS_ContentFlagging") - }() + defer th.TearDown() client := th.Client @@ -671,12 +642,8 @@ func TestGetTeamPostReportingFeatureStatus(t *testing.T) { } func TestSearchReviewers(t *testing.T) { - os.Setenv("MM_FEATUREFLAGS_ContentFlagging", "true") th := Setup(t).InitBasic() - defer func() { - th.TearDown() - os.Unsetenv("MM_FEATUREFLAGS_ContentFlagging") - }() + defer th.TearDown() client := th.Client @@ -789,12 +756,8 @@ func TestSearchReviewers(t *testing.T) { } func TestAssignContentFlaggingReviewer(t *testing.T) { - os.Setenv("MM_FEATUREFLAGS_ContentFlagging", "true") th := Setup(t).InitBasic() - defer func() { - th.TearDown() - os.Unsetenv("MM_FEATUREFLAGS_ContentFlagging") - }() + defer th.TearDown() client := th.Client diff --git a/server/channels/api4/team_test.go b/server/channels/api4/team_test.go index 25422f424af..716a99d19d5 100644 --- a/server/channels/api4/team_test.go +++ b/server/channels/api4/team_test.go @@ -10,7 +10,6 @@ import ( "encoding/json" "fmt" "net/http" - "os" "strconv" "strings" "testing" @@ -239,10 +238,6 @@ func TestCreateTeamSanitization(t *testing.T) { func TestGetTeam(t *testing.T) { mainHelper.Parallel(t) - os.Setenv("MM_FEATUREFLAGS_ContentFlagging", "true") - defer func() { - os.Unsetenv("MM_FEATUREFLAGS_ContentFlagging") - }() th := Setup(t).InitBasic() defer th.TearDown() diff --git a/server/public/model/feature_flags.go b/server/public/model/feature_flags.go index d717d80205f..08ea3b34934 100644 --- a/server/public/model/feature_flags.go +++ b/server/public/model/feature_flags.go @@ -113,7 +113,7 @@ func (f *FeatureFlags) SetDefaults() { f.ExperimentalAuditSettingsSystemConsoleUI = true f.CustomProfileAttributes = true f.AttributeBasedAccessControl = true - f.ContentFlagging = false + f.ContentFlagging = true f.InteractiveDialogAppsForm = true f.EnableMattermostEntry = true