diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb index 23d6684a8e6..06beeebe2ba 100644 --- a/app/helpers/blob_helper.rb +++ b/app/helpers/blob_helper.rb @@ -31,12 +31,13 @@ module BlobHelper edit_button_tag(blob, common_classes, _('Edit'), - edit_blob_path(project, ref, path, options), + Feature.enabled?(:web_ide_default) ? ide_edit_path(project, ref, path, options) : edit_blob_path(project, ref, path, options), project, ref) end def ide_edit_button(project = @project, ref = @ref, path = @path, options = {}) + return unless Feature.enabled?(:web_ide_default) return unless blob = readable_blob(options, path, project, ref) edit_button_tag(blob, diff --git a/changelogs/unreleased/web-ide-default-editor.yml b/changelogs/unreleased/web-ide-default-editor.yml new file mode 100644 index 00000000000..b98be5c16c2 --- /dev/null +++ b/changelogs/unreleased/web-ide-default-editor.yml @@ -0,0 +1,5 @@ +--- +title: Make the Web IDE the default editor +merge_request: +author: +type: added diff --git a/spec/features/projects/blobs/edit_spec.rb b/spec/features/projects/blobs/edit_spec.rb index 1522a3361a1..828f6f9921e 100644 --- a/spec/features/projects/blobs/edit_spec.rb +++ b/spec/features/projects/blobs/edit_spec.rb @@ -9,6 +9,10 @@ describe 'Editing file blob', :js do let(:file_path) { project.repository.ls_files(project.repository.root_ref)[1] } let(:readme_file_path) { 'README.md' } + before do + stub_feature_flags(web_ide_default: false) + end + context 'as a developer' do let(:user) { create(:user) } let(:role) { :developer } diff --git a/spec/features/projects/files/user_creates_files_spec.rb b/spec/features/projects/files/user_creates_files_spec.rb index a4f94b7a76d..dd2964c2186 100644 --- a/spec/features/projects/files/user_creates_files_spec.rb +++ b/spec/features/projects/files/user_creates_files_spec.rb @@ -12,6 +12,8 @@ describe 'Projects > Files > User creates files' do let(:user) { create(:user) } before do + stub_feature_flags(web_ide_default: false) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/projects/files/user_edits_files_spec.rb b/spec/features/projects/files/user_edits_files_spec.rb index 9eb65ec159c..ec3930c26db 100644 --- a/spec/features/projects/files/user_edits_files_spec.rb +++ b/spec/features/projects/files/user_edits_files_spec.rb @@ -9,6 +9,8 @@ describe 'Projects > Files > User edits files', :js do let(:user) { create(:user) } before do + stub_feature_flags(web_ide_default: false) + sign_in(user) end diff --git a/spec/helpers/blob_helper_spec.rb b/spec/helpers/blob_helper_spec.rb index f709f152c92..2bc3933809f 100644 --- a/spec/helpers/blob_helper_spec.rb +++ b/spec/helpers/blob_helper_spec.rb @@ -50,12 +50,20 @@ describe BlobHelper do end it 'returns a link with the proper route' do + stub_feature_flags(web_ide_default: false) link = edit_blob_button(project, 'master', 'README.md') expect(Capybara.string(link).find_link('Edit')[:href]).to eq("/#{project.full_path}/edit/master/README.md") end + it 'returns a link with a Web IDE route' do + link = edit_blob_button(project, 'master', 'README.md') + + expect(Capybara.string(link).find_link('Edit')[:href]).to eq("/-/ide/project/#{project.full_path}/edit/master/-/README.md") + end + it 'returns a link with the passed link_opts on the expected route' do + stub_feature_flags(web_ide_default: false) link = edit_blob_button(project, 'master', 'README.md', link_opts: { mr_id: 10 }) expect(Capybara.string(link).find_link('Edit')[:href]).to eq("/#{project.full_path}/edit/master/README.md?mr_id=10")