diff options
author | Robert Speicher <robert@gitlab.com> | 2016-06-22 21:40:17 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-06-22 21:40:17 +0000 |
commit | 69479d3615df62c0c6c22fe20263413505b2ef8f (patch) | |
tree | 08530ceb3e728e6b0117ead6d35e431d0ccf0a75 /lib | |
parent | 9487dd3a40b99c9e42a46885ecc60ebedc34f637 (diff) | |
parent | ceeba75c7650cebc582fc3c04c42d2665a47e511 (diff) | |
download | gitlab-ce-69479d3615df62c0c6c22fe20263413505b2ef8f.tar.gz |
Merge branch 'fix-external-issue-links' into 'master'
Handle external issues in IssueReferenceFilter
Handling of external issues was broken when I refactored
`IssueReferenceFilter` to use fewer SQL queries.
Fixes #18827
See merge request !4789
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 |