summaryrefslogtreecommitdiff
path: root/lib/gitlab/data_builder
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-04-20 10:00:54 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-04-20 10:00:54 +0000
commit3cccd102ba543e02725d247893729e5c73b38295 (patch)
treef36a04ec38517f5deaaacb5acc7d949688d1e187 /lib/gitlab/data_builder
parent205943281328046ef7b4528031b90fbda70c75ac (diff)
downloadgitlab-ce-3cccd102ba543e02725d247893729e5c73b38295.tar.gz
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'lib/gitlab/data_builder')
-rw-r--r--lib/gitlab/data_builder/deployment.rb18
-rw-r--r--lib/gitlab/data_builder/note.rb5
2 files changed, 16 insertions, 7 deletions
diff --git a/lib/gitlab/data_builder/deployment.rb b/lib/gitlab/data_builder/deployment.rb
index a4508bc93c5..0e6841e10a7 100644
--- a/lib/gitlab/data_builder/deployment.rb
+++ b/lib/gitlab/data_builder/deployment.rb
@@ -12,6 +12,16 @@ module Gitlab
Gitlab::UrlBuilder.build(deployment.deployable)
end
+ commit_url =
+ if (commit = deployment.commit)
+ Gitlab::UrlBuilder.build(commit)
+ end
+
+ user_url =
+ if deployment.deployed_by
+ Gitlab::UrlBuilder.build(deployment.deployed_by)
+ end
+
{
object_kind: 'deployment',
status: deployment.status,
@@ -22,10 +32,10 @@ module Gitlab
environment: deployment.environment.name,
project: deployment.project.hook_attrs,
short_sha: deployment.short_sha,
- user: deployment.deployed_by.hook_attrs,
- user_url: Gitlab::UrlBuilder.build(deployment.deployed_by),
- commit_url: Gitlab::UrlBuilder.build(deployment.commit),
- commit_title: deployment.commit.title,
+ user: deployment.deployed_by&.hook_attrs,
+ user_url: user_url,
+ commit_url: commit_url,
+ commit_title: deployment.commit_title,
ref: deployment.ref
}
end
diff --git a/lib/gitlab/data_builder/note.rb b/lib/gitlab/data_builder/note.rb
index 73518d36d43..dec583f5a42 100644
--- a/lib/gitlab/data_builder/note.rb
+++ b/lib/gitlab/data_builder/note.rb
@@ -43,10 +43,9 @@ module Gitlab
if note.for_commit?
data[:commit] = build_data_for_commit(project, user, note)
elsif note.for_issue?
- data[:issue] = note.noteable.hook_attrs
- data[:issue][:labels] = note.noteable.labels_hook_attrs
+ data[:issue] = Gitlab::HookData::IssueBuilder.new(note.noteable).build
elsif note.for_merge_request?
- data[:merge_request] = note.noteable.hook_attrs
+ data[:merge_request] = Gitlab::HookData::MergeRequestBuilder.new(note.noteable).build
elsif note.for_snippet?
data[:snippet] = note.noteable.hook_attrs
end