Commit f6b15131 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'service-desk-permissions' into 'master'

Only show 'Turn on Service Desk' when permissions are present.

Closes #3509

See merge request gitlab-org/gitlab-ee!3020
parents 5566debe 040a77af
---
title: Only show Turn on Service Desk button when user has permissions.
merge_request:
author:
type: fixed
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
- callout_selector = is_empty_state ? 'empty-state' : 'non-empty-state media' - callout_selector = is_empty_state ? 'empty-state' : 'non-empty-state media'
- svg_path = !is_empty_state ? 'shared/empty_states/icons/service_desk_callout.svg' : 'shared/empty_states/icons/service_desk_empty_state.svg' - svg_path = !is_empty_state ? 'shared/empty_states/icons/service_desk_callout.svg' : 'shared/empty_states/icons/service_desk_empty_state.svg'
- can_edit_project_settings = can?(current_user, :admin_project, @project)
%div{ class: "#{callout_selector}" } %div{ class: "#{callout_selector}" }
.service-desk-graphic .service-desk-graphic
...@@ -19,6 +20,6 @@ ...@@ -19,6 +20,6 @@
%span Those emails automatically become issues (with the comments becoming the email conversation) listed here. %span Those emails automatically become issues (with the comments becoming the email conversation) listed here.
= link_to 'Read more', help_page_path('user/project/service_desk') = link_to 'Read more', help_page_path('user/project/service_desk')
- if !service_desk_enabled - if can_edit_project_settings && !service_desk_enabled
.turn-on-btn-container .turn-on-btn-container
= link_to "Turn on Service Desk", edit_project_path(@project), class: 'btn btn-new btn-inverted' = link_to "Turn on Service Desk", edit_project_path(@project), class: 'btn btn-new btn-inverted'
...@@ -31,29 +31,39 @@ describe 'Service Desk Issue Tracker', js: true do ...@@ -31,29 +31,39 @@ describe 'Service Desk Issue Tracker', js: true do
let(:project_without_service_desk) { create(:project, :private, service_desk_enabled: false) } let(:project_without_service_desk) { create(:project, :private, service_desk_enabled: false) }
describe 'service desk info content' do describe 'service desk info content' do
before do context 'when user has permissions to edit project settings' do
project_without_service_desk.add_master(user) before do
visit service_desk_project_issues_path(project_without_service_desk) project_without_service_desk.add_master(user)
end visit service_desk_project_issues_path(project_without_service_desk)
end
it 'displays the large info box' do it 'displays the large info box' do
expect(page).to have_css('.empty-state') expect(page).to have_css('.empty-state')
end end
it 'has a link to the documentation' do
expect(page).to have_link('Read more', href: help_page_path('user/project/service_desk'))
end
it 'has a link to the documentation' do it 'does show a button configure service desk' do
expect(page).to have_link('Read more', href: help_page_path('user/project/service_desk')) expect(page).to have_link('Turn on Service Desk')
end
end end
it 'does show a button configure service desk' do context 'when user does not have permission to edit project settings' do
expect(page).to have_link('Turn on Service Desk') before do
project_without_service_desk.add_guest(user)
visit service_desk_project_issues_path(project_without_service_desk)
end
it 'does not show a button configure service desk' do
expect(page).not_to have_link('Turn on Service Desk')
end
end end
end end
end end
context 'when service desk has been activated' do context 'when service desk has been activated' do
before do
end
context 'when there are no issues' do context 'when there are no issues' do
describe 'service desk info content' do describe 'service desk info content' do
before do before do
......
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