From e716afa230eb3d83fbd30e9b2fc9c3ab2dfb0d83 Mon Sep 17 00:00:00 2001
From: bmarjanovic <bmarjanovic@gitlab.com>
Date: Tue, 25 Jul 2023 09:29:56 +0200
Subject: [PATCH] Fix code suggestions order issue

---
 ee/lib/api/code_suggestions.rb                | 2 +-
 ee/spec/requests/api/code_suggestions_spec.rb | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ee/lib/api/code_suggestions.rb b/ee/lib/api/code_suggestions.rb
index 3c21e90f4f7e..e375a7b94ac9 100644
--- a/ee/lib/api/code_suggestions.rb
+++ b/ee/lib/api/code_suggestions.rb
@@ -23,8 +23,8 @@ def user_allowed?
       end
 
       def active_code_suggestions_purchase?(project_id)
-        return false unless project_id
         return true unless ::Feature.enabled?(:purchase_code_suggestions)
+        return false unless project_id
 
         cache_key = format(PROJECT_CODE_SUGGESTIONS_ADD_ON_CACHE_KEY, project_id: project_id)
         Rails.cache.fetch(cache_key, expires_in: 1.hour) do
diff --git a/ee/spec/requests/api/code_suggestions_spec.rb b/ee/spec/requests/api/code_suggestions_spec.rb
index 27d14fc83313..e6ea4735f10f 100644
--- a/ee/spec/requests/api/code_suggestions_spec.rb
+++ b/ee/spec/requests/api/code_suggestions_spec.rb
@@ -333,7 +333,7 @@
           stub_feature_flags(purchase_code_suggestions: false)
         end
 
-        include_examples 'a not found response'
+        it_behaves_like 'code completions endpoint'
       end
     end
 
-- 
GitLab