From d9698628d9042e820917e1144535888da147c228 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Fri, 27 Mar 2015 12:16:34 +0100 Subject: Add Commit#author and #committer. --- app/models/commit.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/models/commit.rb') diff --git a/app/models/commit.rb b/app/models/commit.rb index e0461809e10..481300171be 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -126,6 +126,14 @@ class Commit "commit #{id}" end + def author + User.find_for_commit(author_email, author_name) + end + + def committer + User.find_for_commit(committer_email, committer_name) + end + def method_missing(m, *args, &block) @raw.send(m, *args, &block) end -- cgit v1.2.1 From 65bb0c34066eef77647e1d60e6bac7a12993cd93 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Fri, 27 Mar 2015 12:19:48 +0100 Subject: Only allow users to cross-reference and close issues they have access to. --- app/models/commit.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/models/commit.rb') diff --git a/app/models/commit.rb b/app/models/commit.rb index 481300171be..084cf420079 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -117,8 +117,8 @@ class Commit # Discover issues should be closed when this commit is pushed to a project's # default branch. - def closes_issues(project) - Gitlab::ClosingIssueExtractor.closed_by_message_in_project(safe_message, project) + def closes_issues(project, current_user = self.committer) + Gitlab::ClosingIssueExtractor.closed_by_message_in_project(safe_message, project, current_user) end # Mentionable override. -- cgit v1.2.1 From e33ddfebf2248fe31bb27fe1d34048df97ed61b0 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Fri, 3 Apr 2015 18:03:26 +0200 Subject: Refactor ClosingIssueExtractor. --- 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 084cf420079..7a0ad137650 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -118,7 +118,7 @@ class Commit # Discover issues should be closed when this commit is pushed to a project's # default branch. def closes_issues(project, current_user = self.committer) - Gitlab::ClosingIssueExtractor.closed_by_message_in_project(safe_message, project, current_user) + Gitlab::ClosingIssueExtractor.new(project, current_user).closed_by_message(safe_message) end # Mentionable override. -- cgit v1.2.1