Commit f30dc89f authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'id-remove-code-navigation-ff' into 'master'

Remove code_navigation feature flag

See merge request gitlab-org/gitlab!43599
parents 66657f2e 1ead1684
......@@ -179,9 +179,7 @@ export default class BlobViewer {
viewer.innerHTML = data.html;
viewer.setAttribute('data-loaded', 'true');
if (window.gon?.features?.codeNavigation) {
eventHub.$emit('showBlobInteractionZones', viewer.dataset.path);
}
eventHub.$emit('showBlobInteractionZones', viewer.dataset.path);
return viewer;
});
......
import Vue from 'vue';
import Vuex from 'vuex';
import store from './store';
import createStore from './store';
import App from './components/app.vue';
Vue.use(Vuex);
export default initialData => {
const el = document.getElementById('js-code-navigation');
if (!el) return null;
Vue.use(Vuex);
const store = createStore();
store.dispatch('setInitialData', initialData);
return new Vue({
......
......@@ -3,8 +3,9 @@ import createState from './state';
import actions from './actions';
import mutations from './mutations';
export default new Vuex.Store({
actions,
mutations,
state: createState(),
});
export default () =>
new Vuex.Store({
actions,
mutations,
state: createState(),
});
......@@ -85,11 +85,9 @@ export default {
},
},
updated() {
if (window.gon?.features?.codeNavigation) {
this.$nextTick(() => {
eventHub.$emit('showBlobInteractionZones', this.diffFile.new_path);
});
}
this.$nextTick(() => {
eventHub.$emit('showBlobInteractionZones', this.diffFile.new_path);
});
},
methods: {
...mapActions('diffs', ['saveDiffDiscussion', 'closeDiffFileCommentForm']),
......
......@@ -103,7 +103,7 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => {
commit(types.VIEW_DIFF_FILE, state.diffFiles[0].file_hash);
}
if (gon.features?.codeNavigation) {
if (state.diffFiles?.length) {
// eslint-disable-next-line promise/catch-or-return,promise/no-nesting
import('~/code_navigation').then(m =>
m.default({
......
......@@ -58,7 +58,7 @@ document.addEventListener('DOMContentLoaded', () => {
const codeNavEl = document.getElementById('js-code-navigation');
if (gon.features?.codeNavigation && codeNavEl) {
if (codeNavEl) {
const { codeNavigationPath, blobPath, definitionPathPrefix } = codeNavEl.dataset;
// eslint-disable-next-line promise/catch-or-return
......
......@@ -33,7 +33,6 @@ class Projects::BlobController < Projects::ApplicationController
before_action :set_last_commit_sha, only: [:edit, :update]
before_action only: :show do
push_frontend_feature_flag(:code_navigation, @project, default_enabled: true)
push_frontend_feature_flag(:suggest_pipeline) if experiment_enabled?(:suggest_pipeline)
push_frontend_feature_flag(:gitlab_ci_yml_preview, @project, default_enabled: false)
end
......
......@@ -29,7 +29,6 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
before_action only: [:show] do
push_frontend_feature_flag(:deploy_from_footer, @project, default_enabled: true)
push_frontend_feature_flag(:suggest_pipeline) if experiment_enabled?(:suggest_pipeline)
push_frontend_feature_flag(:code_navigation, @project, default_enabled: true)
push_frontend_feature_flag(:widget_visibility_polling, @project, default_enabled: true)
push_frontend_feature_flag(:merge_ref_head_comments, @project, default_enabled: true)
push_frontend_feature_flag(:mr_commit_neighbor_nav, @project, default_enabled: true)
......
......@@ -758,10 +758,6 @@ module ProjectsHelper
!project.repository.gitlab_ci_yml
end
def native_code_navigation_enabled?(project)
Feature.enabled?(:code_navigation, project, default_enabled: true)
end
def show_visibility_confirm_modal?(project)
project.unlink_forks_upon_visibility_decrease_enabled? && project.visibility_level > Gitlab::VisibilityLevel::PRIVATE && project.forks_count > 0
end
......
......@@ -78,7 +78,7 @@ class DiffsEntity < Grape::Entity
options[:merge_request_diffs]
end
expose :definition_path_prefix, if: -> (diff_file) { Feature.enabled?(:code_navigation, merge_request.project, default_enabled: true) } do |diffs|
expose :definition_path_prefix do |diffs|
project_blob_path(merge_request.project, diffs.diff_refs&.head_sha)
end
......@@ -89,8 +89,6 @@ class DiffsEntity < Grape::Entity
private
def code_navigation_path(diffs)
return unless Feature.enabled?(:code_navigation, merge_request.project, default_enabled: true)
Gitlab::CodeNavigationPath.new(merge_request.project, diffs.diff_refs&.head_sha)
end
......
......@@ -37,8 +37,6 @@ class PaginatedDiffEntity < Grape::Entity
private
def code_navigation_path(diffs)
return unless Feature.enabled?(:code_navigation, merge_request.project, default_enabled: true)
Gitlab::CodeNavigationPath.new(merge_request.project, diffs.diff_refs&.head_sha)
end
......
......@@ -52,24 +52,15 @@ module Ci
attr_reader :job, :project
def validate_requirements(artifact_type:, filesize:)
return forbidden_type_error(artifact_type) if forbidden_type?(artifact_type)
return too_large_error if too_large?(artifact_type, filesize)
success
end
def forbidden_type?(type)
lsif?(type) && !code_navigation_enabled?
end
def too_large?(type, size)
size > max_size(type) if size
end
def code_navigation_enabled?
Feature.enabled?(:code_navigation, project, default_enabled: true)
end
def lsif?(type)
type == LSIF_ARTIFACT_TYPE
end
......
......@@ -43,7 +43,6 @@
.tab-content#diff-notes-app
#js-diff-file-finder
- if native_code_navigation_enabled?(@project)
#js-code-navigation
= render "projects/merge_requests/tabs/pane", id: "notes", class: "notes voting_notes" do
.row
......
---
name: code_navigation
introduced_by_url:
rollout_issue_url:
group:
type: development
default_enabled: true
......@@ -13,7 +13,6 @@ module Gitlab
end
def full_json_path_for(path)
return unless Feature.enabled?(:code_navigation, project, default_enabled: true)
return unless build
raw_project_job_artifacts_path(project, build, path: "lsif/#{path}.json", file_type: :lsif)
......
......@@ -16,10 +16,6 @@ RSpec.describe Gitlab::CodeNavigationPath do
subject { described_class.new(project, commit_sha).full_json_path_for(path) }
before do
stub_feature_flags(code_navigation: project)
end
context 'when a pipeline exist for a sha' do
it 'returns path to a file in the artifact' do
expect(subject).to eq(lsif_path)
......@@ -41,15 +37,5 @@ RSpec.describe Gitlab::CodeNavigationPath do
expect(subject).to eq(lsif_path)
end
end
context 'when code_navigation feature is disabled' do
before do
stub_feature_flags(code_navigation: false)
end
it 'returns nil' do
expect(subject).to be_nil
end
end
end
end
......@@ -227,10 +227,6 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do
end
context 'authorize uploading of an lsif artifact' do
before do
stub_feature_flags(code_navigation: job.project)
end
it 'adds ProcessLsif header' do
authorize_artifacts_with_token_in_headers(artifact_type: :lsif)
......@@ -249,32 +245,6 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do
.to change { Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(tracking_params) }
.by(1)
end
context 'code_navigation feature flag is disabled' do
before do
stub_feature_flags(code_navigation: false)
end
it 'responds with a forbidden error' do
authorize_artifacts_with_token_in_headers(artifact_type: :lsif)
aggregate_failures do
expect(response).to have_gitlab_http_status(:forbidden)
expect(json_response['ProcessLsif']).to be_falsy
end
end
it 'does not track code_intelligence usage ping' do
tracking_params = {
event_names: 'i_source_code_code_intelligence',
start_date: Date.yesterday,
end_date: Date.today
}
expect { authorize_artifacts_with_token_in_headers(artifact_type: :lsif) }
.not_to change { Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(tracking_params) }
end
end
end
def authorize_artifacts(params = {}, request_headers = headers)
......
......@@ -68,15 +68,5 @@ RSpec.describe DiffsEntity do
end
end
end
context 'when code_navigation feature flag is disabled' do
it 'does not include code navigation properties' do
stub_feature_flags(code_navigation: false)
expect(Gitlab::CodeNavigationPath).not_to receive(:new)
expect(subject).not_to include(:definition_path_prefix)
end
end
end
end
......@@ -31,14 +31,4 @@ RSpec.describe PaginatedDiffEntity do
total_pages: 7
)
end
context 'when code_navigation feature flag is disabled' do
it 'does not execute Gitlab::CodeNavigationPath' do
stub_feature_flags(code_navigation: false)
expect(Gitlab::CodeNavigationPath).not_to receive(:new)
subject
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment