diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-06-20 12:53:08 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-06-21 21:01:56 +0300 |
commit | ceeba75c7650cebc582fc3c04c42d2665a47e511 (patch) | |
tree | 8cf3927413994821799e7f4ce4ddb3ed0f2129c7 /lib | |
parent | 44b8b77e02423ce97f9abe80e0335f4f4c453c83 (diff) |
Handle external issues in IssueReferenceFilter
In the past this class would use Project#get_issue to retrieve an issue
by its ID. This method would automatically determine whether to return
an Issue or ExternalIssue.
This commit changes IssueReferenceFilter to handle external issues again
and in a somewhat more explicit manner than before.
Fixes gitlab-org/gitlab-ce#18827
Diffstat (limited to 'lib')
-rw-r--r-- | lib/banzai/filter/issue_reference_filter.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/banzai/filter/issue_reference_filter.rb b/lib/banzai/filter/issue_reference_filter.rb index 2614261f9eb..5351272f42d 100644 --- a/lib/banzai/filter/issue_reference_filter.rb +++ b/lib/banzai/filter/issue_reference_filter.rb @@ -31,10 +31,14 @@ module Banzai projects_per_reference.each do |path, project| issue_ids = references_per_project[path] - next unless project.default_issues_tracker? + if project.default_issues_tracker? + issues = project.issues.where(iid: issue_ids.to_a) + else + issues = issue_ids.map { |id| ExternalIssue.new(id, project) } + end - project.issues.where(iid: issue_ids.to_a).each do |issue| - hash[project][issue.iid] = issue + issues.each do |issue| + hash[project][issue.iid.to_i] = issue end end |