Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMario de la Ossa <mariodelaossa@gmail.com>2018-10-03 05:56:51 +0300
committerMario de la Ossa <mariodelaossa@gmail.com>2018-10-04 19:12:18 +0300
commit7cb2755617a2f29498f4523b8915bc77abcae4df (patch)
tree8706a18ab3772c1976a43a16f956df094562ed96 /lib
parent42822a7d45f063804fe04f44e15cf04549460ae7 (diff)
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')
-rw-r--r--lib/banzai/cross_project_reference.rb1
-rw-r--r--lib/banzai/filter/label_reference_filter.rb2
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