diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-02-17 13:04:01 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2017-02-17 13:04:01 +0000 |
commit | 29d5a7ab75e224797d014c8954d086cd898a2304 (patch) | |
tree | 8741b1aaedc5b875f816eebd90e2430bba459777 /lib | |
parent | f662bc5a866dc24580caa48952f25061bae60d1a (diff) | |
parent | d5fa77d53d73b9d47647443460d2ea95babb52e4 (diff) | |
download | gitlab-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.rb | 10 |
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 |