diff options
author | Rémy Coutable <remy@rymai.me> | 2018-07-23 09:39:03 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-07-23 09:39:03 +0000 |
commit | 716b1f79f5217d2d0823669a5c1c4feb78a9bd2c (patch) | |
tree | 3943094c7afa29e4e8893046e2c6cd6aa50eb34f | |
parent | 6d5edce815c30160abfc9775be14bbfa1eab279e (diff) | |
parent | f97e532eaaf0e22324a98095021f8b40f673f3ea (diff) | |
download | gitlab-ce-716b1f79f5217d2d0823669a5c1c4feb78a9bd2c.tar.gz |
Merge branch 'project-visibility-tooltip' into 'master'
Fix #47379 - Project visibility tooltip
Closes #47379
See merge request gitlab-org/gitlab-ce!20535
-rw-r--r-- | app/helpers/visibility_level_helper.rb | 5 | ||||
-rw-r--r-- | changelogs/unreleased/project-visibility-tooltip.yml | 5 | ||||
-rw-r--r-- | spec/helpers/visibility_level_helper_spec.rb | 23 |
3 files changed, 30 insertions, 3 deletions
diff --git a/app/helpers/visibility_level_helper.rb b/app/helpers/visibility_level_helper.rb index e395cda03d3..cf2fe5a2019 100644 --- a/app/helpers/visibility_level_helper.rb +++ b/app/helpers/visibility_level_helper.rb @@ -126,10 +126,9 @@ module VisibilityLevelHelper end def visibility_icon_description(form_model) - case form_model - when Project + if form_model.respond_to?(:visibility_level_allowed_as_fork?) 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) end end diff --git a/changelogs/unreleased/project-visibility-tooltip.yml b/changelogs/unreleased/project-visibility-tooltip.yml new file mode 100644 index 00000000000..806c93e493a --- /dev/null +++ b/changelogs/unreleased/project-visibility-tooltip.yml @@ -0,0 +1,5 @@ +--- +title: Fix project visibility tooltip +merge_request: 20535 +author: Jamie Schembri +type: fixed diff --git a/spec/helpers/visibility_level_helper_spec.rb b/spec/helpers/visibility_level_helper_spec.rb index 5077c89d7b4..a3be222b7bd 100644 --- a/spec/helpers/visibility_level_helper_spec.rb +++ b/spec/helpers/visibility_level_helper_spec.rb @@ -6,6 +6,29 @@ describe VisibilityLevelHelper do let(:personal_snippet) { build(:personal_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 context 'used with a Project' do it 'delegates projects to #project_visibility_level_description' do |