diff options
author | Zeger-Jan van de Weg <mail@zjvandeweg.nl> | 2015-10-13 09:41:46 +0200 |
---|---|---|
committer | Zeger-Jan van de Weg <mail@zjvandeweg.nl> | 2015-10-16 09:59:32 +0200 |
commit | 94a788f66dfcc13ad02855b05c38826f958038af (patch) | |
tree | e99ed267a2e646607f05a7632feefd3a776b5d0b /app/models/issue.rb | |
parent | 9f9f0c35ecd9f7a5a057030253791d051f832f6d (diff) | |
download | gitlab-ce-94a788f66dfcc13ad02855b05c38826f958038af.tar.gz |
Only accept open issues and merge requests
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r-- | app/models/issue.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index c24a329847c..72183108033 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -98,11 +98,11 @@ class Issue < ActiveRecord::Base # From all notes on this issue, we'll select the system notes about linked # merge requests. Of those, the MRs closing `self` are returned. - def closed_by_merge_requests(current_user) + def closed_by_merge_requests(current_user = nil) + return [] unless open? + notes.system.flat_map do |note| - ext = Gitlab::ReferenceExtractor.new(self.project, current_user) - ext.analyze(note.note) - ext.merge_requests - end.uniq.select { |mr| mr.closes_issue?(self) } + note.all_references(current_user).merge_requests + end.uniq.select { |mr| mr.open? && mr.closes_issue?(self) } end end |