Fix #47379 - Project visibility tooltip
This commit is contained in:
parent
6d5edce815
commit
f97e532eaa
3 changed files with 30 additions and 3 deletions
|
@ -126,10 +126,9 @@ module VisibilityLevelHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def visibility_icon_description(form_model)
|
def visibility_icon_description(form_model)
|
||||||
case form_model
|
if form_model.respond_to?(:visibility_level_allowed_as_fork?)
|
||||||
when Project
|
|
||||||
project_visibility_icon_description(form_model.visibility_level)
|
project_visibility_icon_description(form_model.visibility_level)
|
||||||
when Group
|
elsif form_model.respond_to?(:visibility_level_allowed_by_sub_groups?)
|
||||||
group_visibility_icon_description(form_model.visibility_level)
|
group_visibility_icon_description(form_model.visibility_level)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
5
changelogs/unreleased/project-visibility-tooltip.yml
Normal file
5
changelogs/unreleased/project-visibility-tooltip.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: Fix project visibility tooltip
|
||||||
|
merge_request: 20535
|
||||||
|
author: Jamie Schembri
|
||||||
|
type: fixed
|
|
@ -6,6 +6,29 @@ describe VisibilityLevelHelper do
|
||||||
let(:personal_snippet) { build(:personal_snippet) }
|
let(:personal_snippet) { build(:personal_snippet) }
|
||||||
let(:project_snippet) { build(:project_snippet) }
|
let(:project_snippet) { build(:project_snippet) }
|
||||||
|
|
||||||
|
describe 'visibility_icon_description' do
|
||||||
|
context 'used with a Project' do
|
||||||
|
it 'delegates projects to #project_visibility_icon_description' do
|
||||||
|
expect(visibility_icon_description(project))
|
||||||
|
.to match /project/i
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'used with a ProjectPresenter' do
|
||||||
|
it 'delegates projects to #project_visibility_icon_description' do
|
||||||
|
expect(visibility_icon_description(project.present))
|
||||||
|
.to match /project/i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'used with a Group' do
|
||||||
|
it 'delegates groups to #group_visibility_icon_description' do
|
||||||
|
expect(visibility_icon_description(group))
|
||||||
|
.to match /group/i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'visibility_level_description' do
|
describe 'visibility_level_description' do
|
||||||
context 'used with a Project' do
|
context 'used with a Project' do
|
||||||
it 'delegates projects to #project_visibility_level_description' do
|
it 'delegates projects to #project_visibility_level_description' do
|
||||||
|
|
Loading…
Reference in a new issue