Commit cb4dc69b authored by Mark Florian's avatar Mark Florian

Merge branch '324971-hide-new-issue-button-on-project-issues-page-from-auditor' into 'master'

Hide "New issue" button from Auditors on empty project issues page

See merge request gitlab-org/gitlab!56877
parents f9090cb1 39aa3d86
......@@ -43,7 +43,7 @@
.text-center
- if project_select_button
= render 'shared/new_project_item_select', path: 'issues/new', label: _('New issue'), type: :issues, with_feature_enabled: 'issues'
- else
- elsif show_new_issue_link?(@project)
= link_to _('New issue'), button_path, class: 'gl-button btn btn-confirm', id: 'new_issue_link'
- if show_import_button
......
---
title: Hide "New issue" button from Auditors on project issues page
merge_request: 56877
author:
type: fixed
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Issues' do
let_it_be(:project) { create(:project, :public) }
let_it_be(:auditor) { create(:user, auditor: true) }
shared_examples 'empty state' do |expect_button|
it "shows empty state #{expect_button ? 'with' : 'without'} \"New issue\" button" do
visit project_issues_path(project)
expect(page).to have_content('The Issue Tracker is the place to add things that need to be improved or solved in a project')
expect(page).to have_content('Issues can be bugs, tasks or ideas to be discussed. Also, issues are searchable and filterable.')
expect(page.has_link?('New issue')).to be(expect_button)
end
end
context 'when signed in user is an Auditor' do
before do
sign_in(auditor)
end
context 'when user is not a member of the project' do
it_behaves_like 'empty state', false
end
context 'when user is a member of the project' do
before do
project.add_guest(auditor)
end
it_behaves_like 'empty state', true
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