summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-10-27 16:09:11 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2017-10-27 16:18:20 +0200
commit2c9367da94dbcfc7590fdf05b38e1a12885fa519 (patch)
treeb45a338bfa8efe9d49a9f749e700e8942d1dd434
parent6d205a9b2ce975b8bfa048c4e68eed7f7402b99a (diff)
downloadgitlab-ce-bvl-fix-system-hook-project-visibility.tar.gz
Use the correct project visibility in system hooksbvl-fix-system-hook-project-visibility
-rw-r--r--app/services/system_hooks_service.rb2
-rw-r--r--changelogs/unreleased/bvl-fix-system-hook-project-visibility.yml5
-rw-r--r--spec/services/system_hooks_service_spec.rb6
3 files changed, 12 insertions, 1 deletions
diff --git a/app/services/system_hooks_service.rb b/app/services/system_hooks_service.rb
index a1c2f8d0180..5d275967821 100644
--- a/app/services/system_hooks_service.rb
+++ b/app/services/system_hooks_service.rb
@@ -83,7 +83,7 @@ class SystemHooksService
project_id: model.id,
owner_name: owner.name,
owner_email: owner.respond_to?(:email) ? owner.email : "",
- project_visibility: Project.visibility_levels.key(model.visibility_level_value).downcase
+ project_visibility: model.visibility.downcase
}
end
diff --git a/changelogs/unreleased/bvl-fix-system-hook-project-visibility.yml b/changelogs/unreleased/bvl-fix-system-hook-project-visibility.yml
new file mode 100644
index 00000000000..a17ed51c9b8
--- /dev/null
+++ b/changelogs/unreleased/bvl-fix-system-hook-project-visibility.yml
@@ -0,0 +1,5 @@
+---
+title: Use the correct visibility attribute for projects in system hooks
+merge_request: 15065
+author:
+type: fixed
diff --git a/spec/services/system_hooks_service_spec.rb b/spec/services/system_hooks_service_spec.rb
index 8b5d9187785..8f7aea533dc 100644
--- a/spec/services/system_hooks_service_spec.rb
+++ b/spec/services/system_hooks_service_spec.rb
@@ -63,6 +63,12 @@ describe SystemHooksService do
:group_id, :user_id, :user_username, :user_name, :user_email, :group_access
)
end
+
+ it 'includes the correct project visibility level' do
+ data = event_data(project, :create)
+
+ expect(data[:project_visibility]).to eq('private')
+ end
end
context 'event names' do