Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
543b39f2
Commit
543b39f2
authored
Jun 24, 2021
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor changes for review comments
parent
3b37758c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
18 deletions
+7
-18
lib/banzai/filter/references/label_reference_filter.rb
lib/banzai/filter/references/label_reference_filter.rb
+3
-1
lib/banzai/filter/references/milestone_reference_filter.rb
lib/banzai/filter/references/milestone_reference_filter.rb
+4
-17
No files found.
lib/banzai/filter/references/label_reference_filter.rb
View file @
543b39f2
...
...
@@ -23,7 +23,9 @@ module Banzai
label_relation
=
labels
.
where
(
title:
label_names
)
end
Label
.
from_union
([
id_relation
,
label_relation
].
compact
)
return
Label
.
none
if
(
relation
=
[
id_relation
,
label_relation
].
compact
).
empty?
Label
.
from_union
(
relation
)
end
def
find_object
(
parent_object
,
id
)
...
...
lib/banzai/filter/references/milestone_reference_filter.rb
View file @
543b39f2
...
...
@@ -23,16 +23,11 @@ module Banzai
milestone_relation
=
find_milestones
(
parent
,
false
).
where
(
name:
milestone_names
)
end
if
(
relation
=
[
iid_relation
,
milestone_relation
].
compact
).
empty?
Milestone
.
none
else
Milestone
.
from_union
(
relation
).
includes
(
:project
,
:group
)
end
return
Milestone
.
none
if
(
relation
=
[
iid_relation
,
milestone_relation
].
compact
).
empty?
Milestone
.
from_union
(
relation
).
includes
(
:project
,
:group
)
end
# Links to project milestones contain the IID, but when we're handling
# 'regular' references, we need to use the global ID to disambiguate
# between group and project milestones.
def
find_object
(
parent_object
,
id
)
key
=
reference_cache
.
records_per_parent
[
parent_object
].
keys
.
find
do
|
k
|
k
[
:milestone_iid
]
==
id
[
:milestone_iid
]
||
k
[
:milestone_name
]
==
id
[
:milestone_name
]
...
...
@@ -46,7 +41,7 @@ module Banzai
# This method has the contract that if a string `ref` refers to a
# record `record`, then `parse_symbol(ref) == record_identifier(record)`.
#
# This contract is slightly broken here, as we only have either the milestone_id
# This contract is slightly broken here, as we only have either the milestone_i
i
d
# or the milestone_name, but not both. But below, we have both pieces of information.
# But it's accounted for in `find_object`
def
parse_symbol
(
symbol
,
match_data
)
...
...
@@ -59,8 +54,6 @@ module Banzai
end
end
# We assume that most classes are identifying records by ID.
#
# This method has the contract that if a string `ref` refers to a
# record `record`, then `class.parse_symbol(ref) == record_identifier(record)`.
# See note in `parse_symbol` above
...
...
@@ -68,12 +61,6 @@ module Banzai
{
milestone_iid:
record
.
iid
,
milestone_name:
record
.
name
}
end
# def find_object_from_link(parent, iid)
# return unless valid_context?(parent)
#
# find_milestone_with_finder(parent, iid: iid)
# end
def
valid_context?
(
parent
)
strong_memoize
(
:valid_context
)
do
group_context?
(
parent
)
||
project_context?
(
parent
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment