diff options
author | Mario de la Ossa <mariodelaossa@gmail.com> | 2018-10-02 20:56:51 -0600 |
---|---|---|
committer | Mario de la Ossa <mariodelaossa@gmail.com> | 2018-10-04 10:12:18 -0600 |
commit | 7cb2755617a2f29498f4523b8915bc77abcae4df (patch) | |
tree | 8706a18ab3772c1976a43a16f956df094562ed96 /lib/banzai | |
parent | 42822a7d45f063804fe04f44e15cf04549460ae7 (diff) | |
download | gitlab-ce-7cb2755617a2f29498f4523b8915bc77abcae4df.tar.gz |
Banzai project ref- share context more aggresively
Changes `Banzai::CrossProjectReference#parent_from_ref` to return the
project in the context if the project's `full_path` matches the ref
we're looking for, as it makes no sense to go to the database to find a
Project we already have loaded.
Diffstat (limited to 'lib/banzai')
-rw-r--r-- | lib/banzai/cross_project_reference.rb | 1 | ||||
-rw-r--r-- | lib/banzai/filter/label_reference_filter.rb | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/banzai/cross_project_reference.rb b/lib/banzai/cross_project_reference.rb index 3f1e95d4cc0..43f913a8859 100644 --- a/lib/banzai/cross_project_reference.rb +++ b/lib/banzai/cross_project_reference.rb @@ -13,6 +13,7 @@ module Banzai # Returns a Project, or nil if the reference can't be found def parent_from_ref(ref) return context[:project] || context[:group] unless ref + return context[:project] if context[:project]&.full_path == ref Project.find_by_full_path(ref) end diff --git a/lib/banzai/filter/label_reference_filter.rb b/lib/banzai/filter/label_reference_filter.rb index b92e9e55bb9..04ec38209c7 100644 --- a/lib/banzai/filter/label_reference_filter.rb +++ b/lib/banzai/filter/label_reference_filter.rb @@ -48,7 +48,7 @@ module Banzai include_ancestor_groups: true, only_group_labels: true } else - { project_id: parent.id, + { project: parent, include_ancestor_groups: true } end |