diff options
author | Gabriel Gizotti <gabriel@gizotti.com> | 2016-12-05 14:44:29 +0300 |
---|---|---|
committer | Gabriel Gizotti <gabriel@gizotti.com> | 2016-12-16 12:13:17 +0300 |
commit | 7d7ae494d476f2e0588740612846da4284b3da0c (patch) | |
tree | 77e9b14e36f5858d5a4425ac10bbd2c5a2b3ced3 /app/models/merge_request.rb | |
parent | 5d478e5ceec3db9c38ef2ab1fafd7235fe3bb244 (diff) |
add guard clause to MergeRequest#issues_mentioned_but_not_closing
Diffstat (limited to 'app/models/merge_request.rb')
-rw-r--r-- | app/models/merge_request.rb | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index da293c3738f..acaf14a12e9 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -569,17 +569,14 @@ class MergeRequest < ActiveRecord::Base end def issues_mentioned_but_not_closing(current_user = self.author) - issues = [] - closing_issues = [] + return [] unless target_branch == project.default_branch - if target_branch == project.default_branch - ext = Gitlab::ReferenceExtractor.new(project, current_user) - ext.analyze(description) + ext = Gitlab::ReferenceExtractor.new(project, current_user) + ext.analyze(description) - issues = ext.issues - closing_issues = Gitlab::ClosingIssueExtractor.new(project, current_user). - closed_by_message(description) - end + issues = ext.issues + closing_issues = Gitlab::ClosingIssueExtractor.new(project, current_user). + closed_by_message(description) issues - closing_issues end |