diff --git a/server/channels/api4/post.go b/server/channels/api4/post.go index aca668585b..090c195cbd 100644 --- a/server/channels/api4/post.go +++ b/server/channels/api4/post.go @@ -1136,7 +1136,7 @@ func moveThread(c *Context, w http.ResponseWriter, r *http.Request) { return } - if !c.App.Config().FeatureFlags.MoveThreadsEnabled { + if !c.App.Config().FeatureFlags.MoveThreadsEnabled || c.App.License() == nil { c.Err = model.NewAppError("moveThread", "api.post.move_thread.disabled.app_error", nil, "", http.StatusNotImplemented) return } diff --git a/server/channels/api4/post_test.go b/server/channels/api4/post_test.go index db57b23767..11e4c77f77 100644 --- a/server/channels/api4/post_test.go +++ b/server/channels/api4/post_test.go @@ -733,9 +733,11 @@ func TestCreatePostWithOutgoingHook_no_content_type(t *testing.T) { func TestMoveThread(t *testing.T) { os.Setenv("MM_FEATUREFLAGS_MOVETHREADSENABLED", "true") defer os.Unsetenv("MM_FEATUREFLAGS_MOVETHREADSENABLED") - th := Setup(t).InitBasic() + th := SetupEnterprise(t).InitBasic() defer th.TearDown() + th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuEnterprise)) + client := th.Client ctx := context.Background() @@ -949,13 +951,6 @@ func TestMoveThread(t *testing.T) { require.NoError(t, err) require.NotNil(t, resp) require.NotNil(t, posts) - // There should be 3 posts, the system join message for the user who moved it joining the channel, and the two posts in the thread - // require.Equal(t, 3, len(posts.Posts)) - fmt.Println(posts.Order) - for _, p := range posts.Order { - fmt.Println(posts.Posts[p].Id) - fmt.Println(posts.Posts[p].Message) - } require.Equal(t, "This thread was moved from another channel", posts.Posts[posts.Order[0]].Message) require.Equal(t, newPost2.Message, posts.Posts[posts.Order[1]].Message) require.Equal(t, newPost.Message, posts.Posts[posts.Order[2]].Message) diff --git a/webapp/channels/src/components/admin_console/admin_definition.tsx b/webapp/channels/src/components/admin_console/admin_definition.tsx index 4d7b3f5ca5..13e23d3374 100644 --- a/webapp/channels/src/components/admin_console/admin_definition.tsx +++ b/webapp/channels/src/components/admin_console/admin_definition.tsx @@ -3203,7 +3203,7 @@ const AdminDefinition: AdminDefinitionType = { url: 'site_config/wrangler', title: t('admin.sidebar.move_thread'), title_default: 'Move Thread (Beta)', - isHidden: it.any(it.not(it.userHasReadPermissionOnResource(RESOURCE_KEYS.SITE.POSTS)), it.configIsFalse('FeatureFlags', 'MoveThreadsEnabled')), + isHidden: it.any(it.not(it.userHasReadPermissionOnResource(RESOURCE_KEYS.SITE.POSTS)), it.configIsFalse('FeatureFlags', 'MoveThreadsEnabled'), it.not(it.licensed)), schema: { id: 'WranglerSettings', name: t('admin.site.move_thread'), diff --git a/webapp/channels/src/packages/mattermost-redux/src/selectors/entities/preferences.ts b/webapp/channels/src/packages/mattermost-redux/src/selectors/entities/preferences.ts index 510225ad46..b4212e71f9 100644 --- a/webapp/channels/src/packages/mattermost-redux/src/selectors/entities/preferences.ts +++ b/webapp/channels/src/packages/mattermost-redux/src/selectors/entities/preferences.ts @@ -277,7 +277,7 @@ export function cloudReverseTrial(state: GlobalState): boolean { } export function moveThreadsEnabled(state: GlobalState): boolean { - return getFeatureFlagValue(state, 'MoveThreadsEnabled') === 'true'; + return getFeatureFlagValue(state, 'MoveThreadsEnabled') === 'true' && getLicense(state).IsLicensed === 'true'; } export function streamlinedMarketplaceEnabled(state: GlobalState): boolean {