From a709cce3ef830c1d4e7f4eb3d5ee79ae4fea3415 Mon Sep 17 00:00:00 2001
From: Cindy Halim <chalim@gitlab.com>
Date: Wed, 2 Oct 2024 02:49:05 +0000
Subject: [PATCH] Remove web_ide_oauth flag and its references

Changelog: other
---
 .../development/web_ide_oauth.yml             |  8 -----
 doc/user/enterprise_user/index.md             |  5 +--
 doc/user/profile/preferences.md               |  5 +--
 doc/user/project/web_ide/index.md             |  5 +--
 .../ee/web_ide/extensions_marketplace_spec.rb |  1 -
 .../settings/settings_integration_spec.rb     |  2 +-
 ee/spec/requests/groups_controller_spec.rb    |  1 -
 lib/web_ide/default_oauth_application.rb      |  2 +-
 lib/web_ide/extensions_marketplace.rb         |  6 ++--
 .../admin/applications_controller_spec.rb     |  4 ---
 spec/helpers/ide_helper_spec.rb               | 33 ++++++++-----------
 .../web_ide/default_oauth_application_spec.rb |  9 +++--
 .../web_ide/extensions_marketplace_spec.rb    | 13 +++-----
 spec/requests/ide_controller_spec.rb          | 22 -------------
 14 files changed, 35 insertions(+), 81 deletions(-)
 delete mode 100644 config/feature_flags/development/web_ide_oauth.yml

diff --git a/config/feature_flags/development/web_ide_oauth.yml b/config/feature_flags/development/web_ide_oauth.yml
deleted file mode 100644
index 78aef7831e229..0000000000000
--- a/config/feature_flags/development/web_ide_oauth.yml
+++ /dev/null
@@ -1,8 +0,0 @@
----
-name: web_ide_oauth
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/138015
-rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/433324
-milestone: '16.7'
-type: development
-group: group::ide
-default_enabled: true
diff --git a/doc/user/enterprise_user/index.md b/doc/user/enterprise_user/index.md
index 7da51e36bfa94..fc2e5bd0be3d9 100644
--- a/doc/user/enterprise_user/index.md
+++ b/doc/user/enterprise_user/index.md
@@ -194,10 +194,11 @@ To disable 2FA:
 ### Enable the extension marketplace for the Web IDE and workspaces
 
 > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/161819) as a [beta](../../policy/experiment-beta-support.md#beta) in GitLab 17.0 [with flags](../../administration/feature_flags.md) named `web_ide_oauth` and `web_ide_extensions_marketplace`. Disabled by default.
-> - [Enabled on GitLab.com](https://gitlab.com/groups/gitlab-org/-/epics/11769) in GitLab 17.4.
+> - Feature flag `web_ide_oauth` [enabled on GitLab.com, self-managed, and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/163181) and feature flag `web_ide_extensions_marketplace` [enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/459028) in GitLab 17.4.
+> - Feature flag `web_ide_oauth` [removed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/167464) in GitLab 17.5.
 
 FLAG:
-The availability of this feature is controlled by feature flags.
+The availability of this feature is controlled by a feature flag.
 For more information, see the history.
 
 If you have the Owner role for a top-level group, you can enable the
diff --git a/doc/user/profile/preferences.md b/doc/user/profile/preferences.md
index 4b1ea7ea983f0..a90a9d0cb0df9 100644
--- a/doc/user/profile/preferences.md
+++ b/doc/user/profile/preferences.md
@@ -404,10 +404,11 @@ DETAILS:
 **Offering:** GitLab.com
 
 > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/151352) as a [beta](../../policy/experiment-beta-support.md#beta) in GitLab 17.0 [with flags](../../administration/feature_flags.md) named `web_ide_oauth` and `web_ide_extensions_marketplace`. Disabled by default.
-> - [Enabled on GitLab.com](https://gitlab.com/groups/gitlab-org/-/epics/11769) in GitLab 17.4.
+> - Feature flag `web_ide_oauth` [enabled on GitLab.com, self-managed, and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/163181) and feature flag `web_ide_extensions_marketplace` [enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/459028) in GitLab 17.4.
+> - Feature flag `web_ide_oauth` [removed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/167464) in GitLab 17.5.
 
 FLAG:
-The availability of this feature is controlled by feature flags.
+The availability of this feature is controlled by a feature flag.
 For more information, see the history.
 
 You can use the [extension marketplace](../project/web_ide/index.md#extension-marketplace) to search and
diff --git a/doc/user/project/web_ide/index.md b/doc/user/project/web_ide/index.md
index a23726537bf11..6253593561f43 100644
--- a/doc/user/project/web_ide/index.md
+++ b/doc/user/project/web_ide/index.md
@@ -245,10 +245,11 @@ DETAILS:
 **Offering:** GitLab.com
 
 > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/151352) as a [beta](../../../policy/experiment-beta-support.md#beta) in GitLab 17.0 [with flags](../../../administration/feature_flags.md) named `web_ide_oauth` and `web_ide_extensions_marketplace`. Disabled by default.
-> - [Enabled on GitLab.com](https://gitlab.com/groups/gitlab-org/-/epics/11769) in GitLab 17.4.
+> - Feature flag `web_ide_oauth` [enabled on GitLab.com, self-managed, and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/163181) and feature flag `web_ide_extensions_marketplace` [enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/459028) in GitLab 17.4.
+> - Feature flag `web_ide_oauth` [removed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/167464) in GitLab 17.5.
 
 FLAG:
-The availability of this feature is controlled by feature flags.
+The availability of this feature is controlled by a feature flag.
 For more information, see the history.
 
 Prerequisites:
diff --git a/ee/spec/lib/ee/web_ide/extensions_marketplace_spec.rb b/ee/spec/lib/ee/web_ide/extensions_marketplace_spec.rb
index 9b867eb15307c..cdf90dfa71f0a 100644
--- a/ee/spec/lib/ee/web_ide/extensions_marketplace_spec.rb
+++ b/ee/spec/lib/ee/web_ide/extensions_marketplace_spec.rb
@@ -32,7 +32,6 @@
       before do
         stub_feature_flags(
           web_ide_extensions_marketplace: current_user,
-          web_ide_oauth: current_user,
           vscode_web_ide: current_user
         )
 
diff --git a/ee/spec/lib/web_ide/settings/settings_integration_spec.rb b/ee/spec/lib/web_ide/settings/settings_integration_spec.rb
index a319b4b3085f5..334e23793e830 100644
--- a/ee/spec/lib/web_ide/settings/settings_integration_spec.rb
+++ b/ee/spec/lib/web_ide/settings/settings_integration_spec.rb
@@ -15,7 +15,7 @@
   subject(:settings) { described_class.get([:vscode_extensions_gallery_metadata], options) }
 
   before do
-    stub_feature_flags(vscode_web_ide: true, web_ide_oauth: true, web_ide_extensions_marketplace: true)
+    stub_feature_flags(vscode_web_ide: true, web_ide_extensions_marketplace: true)
     stub_licensed_features(disable_extensions_marketplace_for_enterprise_users: true)
     user.update!(extensions_marketplace_enabled: true)
   end
diff --git a/ee/spec/requests/groups_controller_spec.rb b/ee/spec/requests/groups_controller_spec.rb
index 64cce94c4e12d..325b97aded90a 100644
--- a/ee/spec/requests/groups_controller_spec.rb
+++ b/ee/spec/requests/groups_controller_spec.rb
@@ -369,7 +369,6 @@
       before do
         stub_feature_flags(
           vscode_web_ide: true,
-          web_ide_oauth: true,
           web_ide_extensions_marketplace: true
         )
       end
diff --git a/lib/web_ide/default_oauth_application.rb b/lib/web_ide/default_oauth_application.rb
index d7b5a3a3b494b..959db953a8bd7 100644
--- a/lib/web_ide/default_oauth_application.rb
+++ b/lib/web_ide/default_oauth_application.rb
@@ -4,7 +4,7 @@ module WebIde
   module DefaultOauthApplication
     class << self
       def feature_enabled?(current_user)
-        Feature.enabled?(:vscode_web_ide, current_user) && Feature.enabled?(:web_ide_oauth, current_user)
+        Feature.enabled?(:vscode_web_ide, current_user)
       end
 
       def oauth_application
diff --git a/lib/web_ide/extensions_marketplace.rb b/lib/web_ide/extensions_marketplace.rb
index 74aeb1b038a2e..4c6e919d49ce7 100644
--- a/lib/web_ide/extensions_marketplace.rb
+++ b/lib/web_ide/extensions_marketplace.rb
@@ -7,8 +7,7 @@ module ExtensionsMarketplace
     # @return [Boolean]
     def self.feature_enabled_for_any_user?
       feature_flag_enabled_for_any_actor?(:web_ide_extensions_marketplace) &&
-        feature_flag_enabled_for_any_actor?(:vscode_web_ide) &&
-        feature_flag_enabled_for_any_actor?(:web_ide_oauth)
+        feature_flag_enabled_for_any_actor?(:vscode_web_ide)
     end
 
     # This returns true if the extensions marketplace feature is available to the given user
@@ -17,8 +16,7 @@ def self.feature_enabled_for_any_user?
     # @return [Boolean]
     def self.feature_enabled?(user:)
       Feature.enabled?(:web_ide_extensions_marketplace, user) &&
-        Feature.enabled?(:vscode_web_ide, user) &&
-        Feature.enabled?(:web_ide_oauth, user)
+        Feature.enabled?(:vscode_web_ide, user)
     end
 
     # This value is used when the end-user is accepting the third-party extension marketplace integration.
diff --git a/spec/controllers/admin/applications_controller_spec.rb b/spec/controllers/admin/applications_controller_spec.rb
index fa15ba607f7da..c18c613c7f629 100644
--- a/spec/controllers/admin/applications_controller_spec.rb
+++ b/spec/controllers/admin/applications_controller_spec.rb
@@ -156,10 +156,6 @@
   describe "#reset_oauth_application_settings" do
     subject(:reset_oauth_application_settings) { post :reset_web_ide_oauth_application_settings }
 
-    before do
-      stub_feature_flags(web_ide_oauth: true)
-    end
-
     it 'returns 500 if no oauth application exists' do
       stub_application_setting(web_ide_oauth_application: nil)
       reset_oauth_application_settings
diff --git a/spec/helpers/ide_helper_spec.rb b/spec/helpers/ide_helper_spec.rb
index 35e7e74aa7a4b..74f6c4148c707 100644
--- a/spec/helpers/ide_helper_spec.rb
+++ b/spec/helpers/ide_helper_spec.rb
@@ -144,30 +144,23 @@
   describe '#show_web_ide_oauth_callback_mismatch_callout?' do
     let_it_be(:oauth_application) { create(:oauth_application, owner: nil) }
 
-    it 'returns false if Web IDE OAuth is not enabled' do
-      stub_feature_flags(vscode_web_ide: true, web_ide_oauth: false)
-      expect(helper.show_web_ide_oauth_callback_mismatch_callout?).to be false
+    before do
+      stub_feature_flags(vscode_web_ide: true)
     end
 
-    context 'when Web IDE OAuth is enabled' do
-      before do
-        stub_feature_flags(vscode_web_ide: true, web_ide_oauth: true)
-      end
-
-      it 'returns false if no Web IDE OAuth application found' do
-        expect(helper.show_web_ide_oauth_callback_mismatch_callout?).to be false
-      end
+    it 'returns false if no Web IDE OAuth application found' do
+      expect(helper.show_web_ide_oauth_callback_mismatch_callout?).to be false
+    end
 
-      it "returns true if domain does not match OAuth application callback URLs" do
-        stub_application_setting({ web_ide_oauth_application: oauth_application })
-        expect(helper.show_web_ide_oauth_callback_mismatch_callout?).to be true
-      end
+    it "returns true if domain does not match OAuth application callback URLs" do
+      stub_application_setting({ web_ide_oauth_application: oauth_application })
+      expect(helper.show_web_ide_oauth_callback_mismatch_callout?).to be true
+    end
 
-      it "returns false if domain matches OAuth application callback URL" do
-        oauth_application.redirect_uri = "#{request.base_url}/oauth-redirect"
-        stub_application_setting({ web_ide_oauth_application: oauth_application })
-        expect(helper.show_web_ide_oauth_callback_mismatch_callout?).to be false
-      end
+    it "returns false if domain matches OAuth application callback URL" do
+      oauth_application.redirect_uri = "#{request.base_url}/oauth-redirect"
+      stub_application_setting({ web_ide_oauth_application: oauth_application })
+      expect(helper.show_web_ide_oauth_callback_mismatch_callout?).to be false
     end
   end
 
diff --git a/spec/lib/web_ide/default_oauth_application_spec.rb b/spec/lib/web_ide/default_oauth_application_spec.rb
index dc2359e771da8..3d67ab7f5c772 100644
--- a/spec/lib/web_ide/default_oauth_application_spec.rb
+++ b/spec/lib/web_ide/default_oauth_application_spec.rb
@@ -7,17 +7,16 @@
   let_it_be(:oauth_application) { create(:oauth_application, owner: nil) }
 
   describe '#feature_enabled?' do
-    where(:vscode_web_ide, :web_ide_oauth, :expectation) do
+    where(:vscode_web_ide, :expectation) do
       [
-        [ref(:current_user), false, false],
-        [false, ref(:current_user), false],
-        [ref(:current_user), ref(:current_user), true]
+        [ref(:current_user), true],
+        [false, false]
       ]
     end
 
     with_them do
       it 'returns the expected value' do
-        stub_feature_flags(vscode_web_ide: vscode_web_ide, web_ide_oauth: web_ide_oauth)
+        stub_feature_flags(vscode_web_ide: vscode_web_ide)
 
         expect(described_class.feature_enabled?(current_user)).to be(expectation)
       end
diff --git a/spec/lib/web_ide/extensions_marketplace_spec.rb b/spec/lib/web_ide/extensions_marketplace_spec.rb
index fbfcedfcc375a..c1d923cdcf826 100644
--- a/spec/lib/web_ide/extensions_marketplace_spec.rb
+++ b/spec/lib/web_ide/extensions_marketplace_spec.rb
@@ -19,19 +19,17 @@
   end
 
   describe 'feature enabled methods' do
-    where(:vscode_web_ide, :web_ide_extensions_marketplace, :web_ide_oauth, :expectation) do
-      ref(:current_user) | ref(:current_user) | ref(:current_user) | true
-      ref(:current_user) | false              | ref(:current_user) | false
-      ref(:current_user) | ref(:current_user) | false              | false
-      false              | ref(:current_user) | false              | false
+    where(:vscode_web_ide, :web_ide_extensions_marketplace, :expectation) do
+      ref(:current_user) | ref(:current_user) | true
+      ref(:current_user) | false              | false
+      false              | ref(:current_user) | false
     end
 
     with_them do
       before do
         stub_feature_flags(
           vscode_web_ide: vscode_web_ide,
-          web_ide_extensions_marketplace: web_ide_extensions_marketplace,
-          web_ide_oauth: web_ide_oauth
+          web_ide_extensions_marketplace: web_ide_extensions_marketplace
         )
       end
 
@@ -72,7 +70,6 @@
       before do
         stub_feature_flags(
           web_ide_extensions_marketplace: current_user,
-          web_ide_oauth: current_user,
           vscode_web_ide: current_user
         )
       end
diff --git a/spec/requests/ide_controller_spec.rb b/spec/requests/ide_controller_spec.rb
index 925484810e9c2..50f0393fa4623 100644
--- a/spec/requests/ide_controller_spec.rb
+++ b/spec/requests/ide_controller_spec.rb
@@ -179,20 +179,6 @@
         end
       end
 
-      describe 'with web_ide_oauth flag off' do
-        before do
-          stub_feature_flags(web_ide_oauth: false)
-        end
-
-        it 'does not create oauth application' do
-          expect(Doorkeeper::Application).not_to receive(:new)
-
-          subject
-
-          expect(web_ide_oauth_application).to be_nil
-        end
-      end
-
       it 'ensures web_ide_oauth_application' do
         expect(Doorkeeper::Application).to receive(:new).and_call_original
 
@@ -264,14 +250,6 @@
 
         expect(response).to have_gitlab_http_status(:not_found)
       end
-
-      it 'with web_ide_oauth flag off, returns not_found' do
-        stub_feature_flags(web_ide_oauth: false)
-
-        oauth_redirect
-
-        expect(response).to have_gitlab_http_status(:not_found)
-      end
     end
   end
 
-- 
GitLab