From 1c9d2e39c1aef8e10ebff6e57c174c197a3a1c93 Mon Sep 17 00:00:00 2001 From: Kirill Zaitsev Date: Mon, 15 Sep 2014 11:10:35 +0400 Subject: Hook attributes --- app/models/commit.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'app/models/commit.rb') diff --git a/app/models/commit.rb b/app/models/commit.rb index c8b2e0475ff..d18738a72dc 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -88,6 +88,21 @@ class Commit description.present? end + def hook_attrs(project) + path_with_namespace = project.path_with_namespace + + { + id: id, + message: safe_message, + timestamp: committed_date.xmlschema, + url: "#{Gitlab.config.gitlab.url}/#{path_with_namespace}/commit/#{id}", + author: { + name: author_name, + email: author_email + } + } + end + # Discover issues should be closed when this commit is pushed to a project's # default branch. def closes_issues project -- cgit v1.2.1 From 2e9f5de86896e53e9cf34aef52bbc2ad08019a21 Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Fri, 26 Sep 2014 00:07:40 +0200 Subject: Add parenthesis to function def with arguments. --- app/models/commit.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/models/commit.rb') diff --git a/app/models/commit.rb b/app/models/commit.rb index c8b2e0475ff..7f586ebe781 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -90,7 +90,7 @@ class Commit # Discover issues should be closed when this commit is pushed to a project's # default branch. - def closes_issues project + def closes_issues(project) Gitlab::ClosingIssueExtractor.closed_by_message_in_project(safe_message, project) end -- cgit v1.2.1