Commit 9c6e38c4 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'jivanvl-remove-gldropdown-branches-ff' into 'master'

Remove gldropdown_branches feature flag [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!59179
parents 448e0ab6 b7fec514
......@@ -12,9 +12,6 @@ class Projects::BranchesController < Projects::ApplicationController
# Support legacy URLs
before_action :redirect_for_legacy_index_sort_or_search, only: [:index]
before_action :limit_diverging_commit_counts!, only: [:diverging_commit_counts]
before_action do
push_frontend_feature_flag(:gldropdown_branches, default_enabled: :yaml)
end
feature_category :source_code_management
......
......@@ -20,10 +20,6 @@ module BranchesHelper
end
end
end
def gldropdrown_branches_enabled?
Feature.enabled?(:gldropdown_branches, default_enabled: :yaml)
end
end
BranchesHelper.prepend_if_ee('EE::BranchesHelper')
......@@ -16,24 +16,6 @@
= link_to s_('Branches|All'), project_branches_filtered_path(@project, state: 'all'), title: s_('Branches|Show all branches')
.nav-controls
- if !gldropdrown_branches_enabled?
= form_tag(project_branches_filtered_path(@project, state: 'all'), method: :get) do
= search_field_tag :search, params[:search], { placeholder: s_('Branches|Filter by branch name'), id: 'branch-search', class: 'form-control search-text-input input-short', spellcheck: false }
- unless @mode == 'overview'
.dropdown.inline>
%button.dropdown-menu-toggle{ type: 'button', 'data-toggle' => 'dropdown' }
%span.light
= branches_sort_options_hash[@sort]
= sprite_icon('chevron-down', css_class: "dropdown-menu-toggle-icon gl-top-3")
%ul.dropdown-menu.dropdown-menu-right.dropdown-menu-selectable
%li.dropdown-header
= s_('Branches|Sort by')
- branches_sort_options_hash.each do |value, title|
%li
= link_to title, project_branches_filtered_path(@project, state: 'all', search: params[:search], sort: value), class: ("is-active" if @sort == value)
- else
#js-branches-sort-dropdown{ data: { project_branches_filtered_path: project_branches_path(@project, state: 'all'), sort_options: branches_sort_options_hash.to_json, mode: @mode } }
- if can? current_user, :push_code, @project
......
---
title: Remove gldropdown_branches feature flag
merge_request: 59179
author:
type: changed
---
name: gldropdown_branches
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/57760
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/326549
milestone: '13.11'
type: development
group: group::continuous integration
default_enabled: true
......@@ -5319,9 +5319,6 @@ msgstr ""
msgid "Branches|Show stale branches"
msgstr ""
msgid "Branches|Sort by"
msgstr ""
msgid "Branches|Stale"
msgstr ""
......
......@@ -11,22 +11,6 @@ RSpec.describe "User deletes branch", :js do
sign_in(user)
end
it "deletes branch" do
stub_feature_flags(gldropdown_branches: false)
visit(project_branches_path(project))
fill_in("branch-search", with: "improve/awesome").native.send_keys(:enter)
page.within(".js-branch-improve\\/awesome") do
accept_alert { find(".btn-danger").click }
end
wait_for_requests
expect(page).to have_css(".js-branch-improve\\/awesome", visible: :hidden)
end
context 'with gldropdown_branches enabled' do
it "deletes branch" do
visit(project_branches_path(project))
......@@ -43,5 +27,4 @@ RSpec.describe "User deletes branch", :js do
expect(page).to have_css(".js-branch-improve\\/awesome", visible: :hidden)
end
end
end
......@@ -85,18 +85,6 @@ RSpec.describe 'Branches' do
end
describe 'Find branches' do
it 'shows filtered branches', :js do
stub_feature_flags(gldropdown_branches: false)
visit project_branches_path(project)
fill_in 'branch-search', with: 'fix'
find('#branch-search').native.send_keys(:enter)
expect(page).to have_content('fix')
expect(find('.all-branches')).to have_selector('li', count: 1)
end
context 'with gldropdown_branches enabled' do
it 'shows filtered branches', :js do
visit project_branches_path(project)
......@@ -109,7 +97,6 @@ RSpec.describe 'Branches' do
expect(find('.all-branches')).to have_selector('li', count: 1)
end
end
end
describe 'Delete unprotected branch on Overview' do
it 'removes branch after confirmation', :js, quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/239019' do
......@@ -129,17 +116,6 @@ RSpec.describe 'Branches' do
expect(page).to have_content(sorted_branches(repository, count: 20, sort_by: :updated_desc))
end
it 'sorts the branches by name' do
stub_feature_flags(gldropdown_branches: false)
visit project_branches_filtered_path(project, state: 'all')
click_button "Last updated" # Open sorting dropdown
click_link "Name"
expect(page).to have_content(sorted_branches(repository, count: 20, sort_by: :name))
end
context 'with gldropdown_branches enabled' do
it 'sorts the branches by name', :js do
visit project_branches_filtered_path(project, state: 'all')
......@@ -150,19 +126,7 @@ RSpec.describe 'Branches' do
expect(page).to have_content(sorted_branches(repository, count: 20, sort_by: :name))
end
end
it 'sorts the branches by oldest updated' do
stub_feature_flags(gldropdown_branches: false)
visit project_branches_filtered_path(project, state: 'all')
click_button "Last updated" # Open sorting dropdown
click_link "Oldest updated"
expect(page).to have_content(sorted_branches(repository, count: 20, sort_by: :updated_asc))
end
context 'with gldropdown_branches enabled' do
it 'sorts the branches by oldest updated', :js do
visit project_branches_filtered_path(project, state: 'all')
......@@ -173,7 +137,6 @@ RSpec.describe 'Branches' do
expect(page).to have_content(sorted_branches(repository, count: 20, sort_by: :updated_asc))
end
end
it 'avoids a N+1 query in branches index' do
control_count = ActiveRecord::QueryRecorder.new { visit project_branches_path(project) }.count
......@@ -185,18 +148,6 @@ RSpec.describe 'Branches' do
end
describe 'Find branches on All branches' do
it 'shows filtered branches', :js do
stub_feature_flags(gldropdown_branches: false)
visit project_branches_filtered_path(project, state: 'all')
fill_in 'branch-search', with: 'fix'
find('#branch-search').native.send_keys(:enter)
expect(page).to have_content('fix')
expect(find('.all-branches')).to have_selector('li', count: 1)
end
context 'with gldropdown_branches enabled' do
it 'shows filtered branches', :js do
visit project_branches_filtered_path(project, state: 'all')
......@@ -209,26 +160,8 @@ RSpec.describe 'Branches' do
expect(find('.all-branches')).to have_selector('li', count: 1)
end
end
end
describe 'Delete unprotected branch on All branches' do
it 'removes branch after confirmation', :js do
stub_feature_flags(gldropdown_branches: false)
visit project_branches_filtered_path(project, state: 'all')
fill_in 'branch-search', with: 'fix'
find('#branch-search').native.send_keys(:enter)
expect(page).to have_content('fix')
expect(find('.all-branches')).to have_selector('li', count: 1)
accept_confirm { find('.js-branch-fix .btn-danger').click }
expect(page).not_to have_content('fix')
expect(find('.all-branches')).to have_selector('li', count: 0)
end
context 'with gldropdown_branches enabled' do
it 'removes branch after confirmation', :js do
visit project_branches_filtered_path(project, state: 'all')
......@@ -245,7 +178,6 @@ RSpec.describe 'Branches' do
expect(find('.all-branches')).to have_selector('li', count: 0)
end
end
end
context 'on project with 0 branch' do
let(:project) { create(:project, :public, :empty_repo) }
......
......@@ -21,17 +21,6 @@ RSpec.describe 'Protected Branches', :js do
expect(ProtectedBranch.count).to eq(1)
end
it 'does not allow developer to removes protected branch' do
stub_feature_flags(gldropdown_branches: false)
visit project_branches_path(project)
fill_in 'branch-search', with: 'fix'
find('#branch-search').native.send_keys(:enter)
expect(page).to have_css('.btn-danger.disabled')
end
context 'with gldropdown_branches enabled' do
it 'does not allow developer to removes protected branch' do
visit project_branches_path(project)
......@@ -42,7 +31,6 @@ RSpec.describe 'Protected Branches', :js do
end
end
end
end
context 'logged in as maintainer' do
before do
......@@ -56,28 +44,6 @@ RSpec.describe 'Protected Branches', :js do
expect(ProtectedBranch.count).to eq(1)
end
it 'removes branch after modal confirmation' do
stub_feature_flags(gldropdown_branches: false)
visit project_branches_path(project)
fill_in 'branch-search', with: 'fix'
find('#branch-search').native.send_keys(:enter)
expect(page).to have_content('fix')
expect(find('.all-branches')).to have_selector('li', count: 1)
page.find('[data-target="#modal-delete-branch"]').click
expect(page).to have_css('.js-delete-branch[disabled]')
fill_in 'delete_branch_input', with: 'fix'
click_link 'Delete protected branch'
fill_in 'branch-search', with: 'fix'
find('#branch-search').native.send_keys(:enter)
expect(page).to have_content('No branches to show')
end
context 'with gldropdown_branches enabled' do
it 'removes branch after modal confirmation' do
visit project_branches_path(project)
......@@ -99,7 +65,6 @@ RSpec.describe 'Protected Branches', :js do
end
end
end
end
context 'logged in as admin' do
before do
......
......@@ -47,19 +47,4 @@ RSpec.describe BranchesHelper do
end
end
end
describe '#gl_dropdown_branches_enabled?' do
context 'when the feature is enabled' do
it 'returns true' do
expect(helper.gldropdrown_branches_enabled?).to be_truthy
end
end
context 'when the feature is disabled' do
it 'returns false' do
stub_feature_flags(gldropdown_branches: false)
expect(helper.gldropdrown_branches_enabled?).to be_falsy
end
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