summaryrefslogtreecommitdiff
path: root/app/models/commit.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-04-13 15:47:18 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-04-13 15:47:18 +0200
commit4af0968c43d517a3d702658749b5117ba4b9e11a (patch)
treed62a15cbcae8e1d1af00208c28fd1b09d01140f1 /app/models/commit.rb
parent872bbb9fe2a5fbb5195aa448b615191baae960d7 (diff)
parentf026e53c4df5b0b3bb7435c05d3c8662afe45881 (diff)
downloadgitlab-ce-4af0968c43d517a3d702658749b5117ba4b9e11a.tar.gz
Merge remote-tracking branch 'origin/master' into ci-commit-as-pipeline
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r--app/models/commit.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index a898f7ba337..9ffdcc59128 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -150,13 +150,11 @@ class Commit
end
def hook_attrs(with_changed_files: false)
- path_with_namespace = project.path_with_namespace
-
data = {
id: id,
message: safe_message,
timestamp: committed_date.xmlschema,
- url: "#{Gitlab.config.gitlab.url}/#{path_with_namespace}/commit/#{id}",
+ url: commit_url,
author: {
name: author_name,
email: author_email
@@ -170,6 +168,10 @@ class Commit
data
end
+ def commit_url
+ project.present? ? "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/commit/#{id}" : ""
+ end
+
# Discover issues should be closed when this commit is pushed to a project's
# default branch.
def closes_issues(current_user = self.committer)