summaryrefslogtreecommitdiff
path: root/app/models/commit.rb
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2016-04-11 16:21:32 -0300
committerFelipe Artur <felipefac@gmail.com>2016-04-11 19:00:59 -0300
commit476cf23fc37d6db8d3fb412ce0b646f228d9aac4 (patch)
tree54cc01cab5b3aee83b07f24310199319db72f598 /app/models/commit.rb
parent4d04e91814fefe24c186250b7962a7c9aa918d1f (diff)
downloadgitlab-ce-476cf23fc37d6db8d3fb412ce0b646f228d9aac4.tar.gz
Allow to close invalid merge request
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 d09876a07d9..11ecfcace14 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)