BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
f7348cd3
Commit
f7348cd3
authored
Apr 19, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix cross-project label ref with invalid project
Closes #15168
parent
2ade37e2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
label_reference_filter.rb
lib/banzai/filter/label_reference_filter.rb
+1
-1
label_reference_filter_spec.rb
spec/lib/banzai/filter/label_reference_filter_spec.rb
+10
-0
No files found.
lib/banzai/filter/label_reference_filter.rb
View file @
f7348cd3
...
@@ -20,7 +20,7 @@ module Banzai
...
@@ -20,7 +20,7 @@ module Banzai
text
.
gsub
(
pattern
)
do
|
match
|
text
.
gsub
(
pattern
)
do
|
match
|
project
=
project_from_ref
(
$~
[
:project
])
project
=
project_from_ref
(
$~
[
:project
])
params
=
label_params
(
$~
[
:label_id
].
to_i
,
$~
[
:label_name
])
params
=
label_params
(
$~
[
:label_id
].
to_i
,
$~
[
:label_name
])
label
=
project
.
labels
.
find_by
(
params
)
label
=
project
.
labels
.
find_by
(
params
)
if
project
if
label
if
label
yield
match
,
label
.
id
,
$~
[
:project
],
$~
yield
match
,
label
.
id
,
$~
[
:project
],
$~
...
...
spec/lib/banzai/filter/label_reference_filter_spec.rb
View file @
f7348cd3
...
@@ -178,6 +178,7 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do
...
@@ -178,6 +178,7 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do
end
end
describe
'cross project label references'
do
describe
'cross project label references'
do
context
'valid project referenced'
do
let
(
:another_project
)
{
create
(
:empty_project
,
:public
)
}
let
(
:another_project
)
{
create
(
:empty_project
,
:public
)
}
let
(
:project_name
)
{
another_project
.
name_with_namespace
}
let
(
:project_name
)
{
another_project
.
name_with_namespace
}
let
(
:label
)
{
create
(
:label
,
project:
another_project
,
color:
'#00ff00'
)
}
let
(
:label
)
{
create
(
:label
,
project:
another_project
,
color:
'#00ff00'
)
}
...
@@ -201,4 +202,13 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do
...
@@ -201,4 +202,13 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do
expect
(
result
.
css
(
'a'
).
first
.
text
).
to
eq
"
#{
label
.
name
}
in
#{
project_name
}
"
expect
(
result
.
css
(
'a'
).
first
.
text
).
to
eq
"
#{
label
.
name
}
in
#{
project_name
}
"
end
end
end
end
context
'project that does not exist referenced'
do
let
(
:result
)
{
reference_filter
(
'aaa/bbb~ccc'
)
}
it
'does not link reference'
do
expect
(
result
.
to_html
).
to
eq
'aaa/bbb~ccc'
end
end
end
end
end
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