diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 12:45:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 12:45:46 +0300 |
commit | a7b3560714b4d9cc4ab32dffcd1f74a284b93580 (patch) | |
tree | 7452bd5c3545c2fa67a28aa013835fb4fa071baf /lib/gitlab/hook_data | |
parent | ee9173579ae56a3dbfe5afe9f9410c65bb327ca7 (diff) |
Add latest changes from gitlab-org/gitlab@14-8-stable-eev14.8.0-rc42
Diffstat (limited to 'lib/gitlab/hook_data')
-rw-r--r-- | lib/gitlab/hook_data/project_builder.rb | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/gitlab/hook_data/project_builder.rb b/lib/gitlab/hook_data/project_builder.rb index 65c237f743f..ebd97d3ab1b 100644 --- a/lib/gitlab/hook_data/project_builder.rb +++ b/lib/gitlab/hook_data/project_builder.rb @@ -16,6 +16,7 @@ module Gitlab # project_id: 1, # owner_name: "John", # owner_email: "user1@example.org", + # owners: [name: "John", email: "user1@example.org"], # project_visibility: "internal", # old_path_with_namespace: "old-path-with-namespace" # } @@ -32,19 +33,33 @@ module Gitlab private def project_data - owner = project.owner + owners = project.owners.compact + # When this is removed, also remove the `deprecated_owner` method + # See https://gitlab.com/gitlab-org/gitlab/-/issues/350603 + owner = project.deprecated_owner { name: project.name, path: project.path, path_with_namespace: project.full_path, project_id: project.id, - owner_name: owner.name, - owner_email: owner.respond_to?(:email) ? owner.email : "", + owner_name: owner.try(:name), + owner_email: user_email(owner), + owners: owners.map do |owner| + owner_data(owner) + end, project_visibility: project.visibility.downcase } end + def owner_data(user) + { name: user.name, email: user_email(user) } + end + + def user_email(user) + user.respond_to?(:email) ? user.email : "" + end + def event_specific_project_data(event) return {} unless event == :rename || event == :transfer |