From e9a78654776bc334f051cda65ffe3d26e492f14b Mon Sep 17 00:00:00 2001
From: Marc Saleiko <marc.saleiko@komadesign.de>
Date: Tue, 11 Mar 2025 13:43:03 +0100
Subject: [PATCH] Changes status feature flag and licensed feature name

---
 app/models/group.rb                              |  4 ++--
 app/models/project.rb                            |  4 ++--
 ...tus.yml => work_item_status_feature_flag.yml} |  2 +-
 ee/app/models/gitlab_subscriptions/features.rb   |  2 +-
 .../work_items/widgets/status_resolver_spec.rb   |  8 ++++----
 ee/spec/models/ee/group_spec.rb                  | 16 ++++++++++------
 ee/spec/models/ee/project_spec.rb                | 16 ++++++++++------
 .../work_item_type_list_ee_shared_examples.rb    |  2 +-
 8 files changed, 31 insertions(+), 23 deletions(-)
 rename config/feature_flags/wip/{work_item_status.yml => work_item_status_feature_flag.yml} (89%)

diff --git a/app/models/group.rb b/app/models/group.rb
index 76c312b5fe4b5..41474f15a929a 100644
--- a/app/models/group.rb
+++ b/app/models/group.rb
@@ -1005,8 +1005,8 @@ def work_items_alpha_feature_flag_enabled?
   end
 
   def work_item_status_feature_available?
-    feature_flag_enabled_for_self_or_ancestor?(:work_item_status, type: :wip) &&
-      licensed_feature_available?(:work_item_custom_status)
+    feature_flag_enabled_for_self_or_ancestor?(:work_item_status_feature_flag, type: :wip) &&
+      licensed_feature_available?(:work_item_status)
   end
 
   def continue_indented_text_feature_flag_enabled?
diff --git a/app/models/project.rb b/app/models/project.rb
index 3e9839657cbca..62149059a2251 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -3316,8 +3316,8 @@ def work_items_alpha_feature_flag_enabled?
   end
 
   def work_item_status_feature_available?
-    (group&.work_item_status_feature_available? || Feature.enabled?(:work_item_status, type: :wip)) &&
-      licensed_feature_available?(:work_item_custom_status)
+    (group&.work_item_status_feature_available? || Feature.enabled?(:work_item_status_feature_flag, type: :wip)) &&
+      licensed_feature_available?(:work_item_status)
   end
 
   def glql_integration_feature_flag_enabled?
diff --git a/config/feature_flags/wip/work_item_status.yml b/config/feature_flags/wip/work_item_status_feature_flag.yml
similarity index 89%
rename from config/feature_flags/wip/work_item_status.yml
rename to config/feature_flags/wip/work_item_status_feature_flag.yml
index 863454fc2957c..fda8f3bc784cb 100644
--- a/config/feature_flags/wip/work_item_status.yml
+++ b/config/feature_flags/wip/work_item_status_feature_flag.yml
@@ -1,5 +1,5 @@
 ---
-name: work_item_status
+name: work_item_status_feature_flag
 feature_issue_url: https://gitlab.com/groups/gitlab-org/-/epics/5099
 introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/182225
 rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/521286
diff --git a/ee/app/models/gitlab_subscriptions/features.rb b/ee/app/models/gitlab_subscriptions/features.rb
index 4eb938dbb384c..a8d4550f68f61 100644
--- a/ee/app/models/gitlab_subscriptions/features.rb
+++ b/ee/app/models/gitlab_subscriptions/features.rb
@@ -188,7 +188,7 @@ class Features
       default_roles_assignees
       ci_component_usages_in_projects
       branch_rule_squash_options
-      work_item_custom_status
+      work_item_status
     ].freeze
 
     ULTIMATE_FEATURES = %i[
diff --git a/ee/spec/graphql/resolvers/work_items/widgets/status_resolver_spec.rb b/ee/spec/graphql/resolvers/work_items/widgets/status_resolver_spec.rb
index edcb0e4115dad..7f0878a4ee056 100644
--- a/ee/spec/graphql/resolvers/work_items/widgets/status_resolver_spec.rb
+++ b/ee/spec/graphql/resolvers/work_items/widgets/status_resolver_spec.rb
@@ -31,7 +31,7 @@
     let(:resource_parent) { group }
 
     before do
-      stub_licensed_features(work_item_custom_status: true)
+      stub_licensed_features(work_item_status: true)
     end
 
     context 'with group' do
@@ -59,9 +59,9 @@
       it_behaves_like 'does not return system defined statuses'
     end
 
-    context 'with work_item_status feature flag disabled' do
+    context 'with work_item_status_feature_flag feature flag disabled' do
       before do
-        stub_feature_flags(work_item_status: false)
+        stub_feature_flags(work_item_status_feature_flag: false)
       end
 
       it_behaves_like 'does not return system defined statuses'
@@ -69,7 +69,7 @@
 
     context 'with work_item_status licensed feature disabled' do
       before do
-        stub_licensed_features(work_item_custom_status: false)
+        stub_licensed_features(work_item_status: false)
       end
 
       it_behaves_like 'does not return system defined statuses'
diff --git a/ee/spec/models/ee/group_spec.rb b/ee/spec/models/ee/group_spec.rb
index 9d24a9551b608..dc985464d2d0b 100644
--- a/ee/spec/models/ee/group_spec.rb
+++ b/ee/spec/models/ee/group_spec.rb
@@ -4325,13 +4325,9 @@ def webhook_headers
   describe '#work_item_status_feature_available?' do
     subject { group.work_item_status_feature_available? }
 
-    before do
-      stub_feature_flags(work_item_status: true)
-    end
-
     context 'when work_item_status licensed feature is enabled' do
       before do
-        stub_licensed_features(work_item_custom_status: true)
+        stub_licensed_features(work_item_status: true)
       end
 
       it { is_expected.to be true }
@@ -4339,7 +4335,15 @@ def webhook_headers
 
     context 'when work_item_status licensed feature is disabled' do
       before do
-        stub_licensed_features(work_item_custom_status: false)
+        stub_licensed_features(work_item_status: false)
+      end
+
+      it { is_expected.to be false }
+    end
+
+    context 'when work_item_status_feature_flag is disabled' do
+      before do
+        stub_feature_flags(work_item_status_feature_flag: false)
       end
 
       it { is_expected.to be false }
diff --git a/ee/spec/models/ee/project_spec.rb b/ee/spec/models/ee/project_spec.rb
index 51fa1f2adb145..1f2e96f81a52b 100644
--- a/ee/spec/models/ee/project_spec.rb
+++ b/ee/spec/models/ee/project_spec.rb
@@ -239,13 +239,9 @@
     describe '#work_item_status_feature_available?' do
       subject { project.work_item_status_feature_available? }
 
-      before do
-        stub_feature_flags(work_item_status: true)
-      end
-
       context 'when work_item_status licensed feature is enabled' do
         before do
-          stub_licensed_features(work_item_custom_status: true)
+          stub_licensed_features(work_item_status: true)
         end
 
         it { is_expected.to be true }
@@ -253,7 +249,15 @@
 
       context 'when work_item_status licensed feature is disabled' do
         before do
-          stub_licensed_features(work_item_custom_status: false)
+          stub_licensed_features(work_item_status: false)
+        end
+
+        it { is_expected.to be false }
+      end
+
+      context 'when work_item_status_feature_flag is disabled' do
+        before do
+          stub_feature_flags(work_item_status_feature_flag: false)
         end
 
         it { is_expected.to be false }
diff --git a/ee/spec/support/shared_examples/requests/api/graphql/work_item_type_list_ee_shared_examples.rb b/ee/spec/support/shared_examples/requests/api/graphql/work_item_type_list_ee_shared_examples.rb
index 67636251d2632..bbe06c2a6a0e5 100644
--- a/ee/spec/support/shared_examples/requests/api/graphql/work_item_type_list_ee_shared_examples.rb
+++ b/ee/spec/support/shared_examples/requests/api/graphql/work_item_type_list_ee_shared_examples.rb
@@ -25,7 +25,7 @@
     include_context 'with work item types request context EE'
 
     it 'returns the allowed custom statuses' do
-      stub_licensed_features(work_item_custom_status: true)
+      stub_licensed_features(work_item_status: true)
       post_graphql(query, current_user: current_user)
 
       work_item_types = graphql_data_at(parent_key, :workItemTypes, :nodes)
-- 
GitLab