summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2017-02-17 13:04:01 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2017-02-17 13:04:01 +0000
commit29d5a7ab75e224797d014c8954d086cd898a2304 (patch)
tree8741b1aaedc5b875f816eebd90e2430bba459777 /lib
parentf662bc5a866dc24580caa48952f25061bae60d1a (diff)
parentd5fa77d53d73b9d47647443460d2ea95babb52e4 (diff)
downloadgitlab-ce-29d5a7ab75e224797d014c8954d086cd898a2304.tar.gz
Merge branch '26500-informative-slack-notifications' into 'master'
Adding links to user & build stage in a Build message Closes #26500 See merge request !8641
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/data_builder/build.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/gitlab/data_builder/build.rb b/lib/gitlab/data_builder/build.rb
index 6548e6475c6..f78106f5b10 100644
--- a/lib/gitlab/data_builder/build.rb
+++ b/lib/gitlab/data_builder/build.rb
@@ -8,6 +8,8 @@ module Gitlab
commit = build.pipeline
user = build.user
+ author_url = build_author_url(build.commit, commit)
+
data = {
object_kind: 'build',
@@ -43,6 +45,7 @@ module Gitlab
message: commit.git_commit_message,
author_name: commit.git_author_name,
author_email: commit.git_author_email,
+ author_url: author_url,
status: commit.status,
duration: commit.duration,
started_at: commit.started_at,
@@ -62,6 +65,13 @@ module Gitlab
data
end
+
+ private
+
+ def build_author_url(commit, pipeline)
+ author = commit.try(:author)
+ author ? Gitlab::Routing.url_helpers.user_url(author) : "mailto:#{pipeline.git_author_email}"
+ end
end
end
end