Commit 7d7944a2 authored by Stan Hu's avatar Stan Hu

Merge branch '8316-maven-package-permissions-option-wrongly-available-in-starter' into 'master'

Resolve "Maven package permissions option wrongly available in Starter"

Closes #8316

See merge request gitlab-org/gitlab-ee!8270
parents c2cbbc3c c48818a3
...@@ -32,7 +32,9 @@ module EE ...@@ -32,7 +32,9 @@ module EE
def get_project_nav_tabs(project, current_user) def get_project_nav_tabs(project, current_user)
nav_tabs = super nav_tabs = super
if ::Gitlab.config.packages.enabled && can?(current_user, :read_package, project) if ::Gitlab.config.packages.enabled &&
project.feature_available?(:packages) &&
can?(current_user, :read_package, project)
nav_tabs << :packages nav_tabs << :packages
end end
...@@ -60,7 +62,7 @@ module EE ...@@ -60,7 +62,7 @@ module EE
override :project_permissions_panel_data override :project_permissions_panel_data
def project_permissions_panel_data(project) def project_permissions_panel_data(project)
super.merge( super.merge(
packagesAvailable: ::Gitlab.config.packages.enabled, packagesAvailable: ::Gitlab.config.packages.enabled && project.feature_available?(:packages),
packagesHelpPath: help_page_path('user/project/packages/maven_repository') packagesHelpPath: help_page_path('user/project/packages/maven_repository')
) )
end end
......
---
title: Don't show packages tab and settings for starter license
merge_request: 8270
author:
type: fixed
...@@ -14,11 +14,29 @@ describe 'Projects > Settings > Packages', :js do ...@@ -14,11 +14,29 @@ describe 'Projects > Settings > Packages', :js do
allow(Gitlab.config.packages).to receive(:enabled).and_return(true) allow(Gitlab.config.packages).to receive(:enabled).and_return(true)
end end
it 'displays the packages toggle button' do context 'allowed by license' do
visit edit_project_path(project) before do
stub_licensed_features(packages: true)
end
it 'displays the packages toggle button' do
visit edit_project_path(project)
expect(page).to have_content('Packages')
expect(page).to have_selector('input[name="project[packages_enabled]"] + button', visible: true)
end
end
context 'not allowed by license' do
before do
stub_licensed_features(packages: false)
end
it 'does not show up in UI' do
visit edit_project_path(project)
expect(page).to have_content('Packages') expect(page).not_to have_content('Packages')
expect(page).to have_selector('input[name="project[packages_enabled]"] + button', visible: true) end
end end
end end
......
...@@ -177,7 +177,7 @@ describe 'Edit Project Settings' do ...@@ -177,7 +177,7 @@ describe 'Edit Project Settings' do
click_button "Save changes" click_button "Save changes"
end end
expect(find(".sharing-permissions")).to have_selector(".project-feature-toggle.is-disabled", count: 3) expect(find(".sharing-permissions")).to have_selector(".project-feature-toggle.is-disabled", count: 2)
end end
it "shows empty features project homepage" do it "shows empty features project homepage" 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