Commit 3deb879f authored by Sean McGivern's avatar Sean McGivern

Merge branch 'fix/27479' into 'master'

Remove new branch button for confidential issues

Closes #27479

See merge request !8894
parents 86af3ed5 afaf6b74
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
// This element is filled in using JavaScript. // This element is filled in using JavaScript.
.content-block.content-block-small .content-block.content-block-small
= render 'new_branch' = render 'new_branch' unless @issue.confidential?
= render 'award_emoji/awards_block', awardable: @issue, inline: true = render 'award_emoji/awards_block', awardable: @issue, inline: true
%section.issuable-discussion %section.issuable-discussion
......
---
title: Remove new branch button for confidential issues
merge_request:
author:
require 'rails_helper' require 'rails_helper'
feature 'Start new branch from an issue', feature: true do feature 'Start new branch from an issue', feature: true, js: true do
let!(:project) { create(:project) } let!(:project) { create(:project) }
let!(:issue) { create(:issue, project: project) } let!(:issue) { create(:issue, project: project) }
let!(:user) { create(:user)} let!(:user) { create(:user)}
...@@ -11,7 +11,7 @@ feature 'Start new branch from an issue', feature: true do ...@@ -11,7 +11,7 @@ feature 'Start new branch from an issue', feature: true do
login_as(user) login_as(user)
end end
it 'shows the new branch button', js: true do it 'shows the new branch button' do
visit namespace_project_issue_path(project.namespace, project, issue) visit namespace_project_issue_path(project.namespace, project, issue)
expect(page).to have_css('#new-branch .available') expect(page).to have_css('#new-branch .available')
...@@ -34,16 +34,26 @@ feature 'Start new branch from an issue', feature: true do ...@@ -34,16 +34,26 @@ feature 'Start new branch from an issue', feature: true do
visit namespace_project_issue_path(project.namespace, project, issue) visit namespace_project_issue_path(project.namespace, project, issue)
end end
it "hides the new branch button", js: true do it "hides the new branch button" do
expect(page).to have_css('#new-branch .unavailable') expect(page).to have_css('#new-branch .unavailable')
expect(page).not_to have_css('#new-branch .available') expect(page).not_to have_css('#new-branch .available')
expect(page).to have_content /1 Related Merge Request/ expect(page).to have_content /1 Related Merge Request/
end end
end end
context 'when issue is confidential' do
it 'hides the new branch button' do
issue = create(:issue, :confidential, project: project)
visit namespace_project_issue_path(project.namespace, project, issue)
expect(page).not_to have_css('#new-branch')
end
end
end end
context "for visiters" do context 'for visitors' do
it 'shows no buttons', js: true do it 'shows no buttons' do
visit namespace_project_issue_path(project.namespace, project, issue) visit namespace_project_issue_path(project.namespace, project, issue)
expect(page).not_to have_css('#new-branch') expect(page).not_to have_css('#new-branch')
......
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