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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
e89d4741
Commit
e89d4741
authored
Apr 15, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix regression in rendering Markdown references that do not exist
Closes #30972
parent
309bab43
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
3 deletions
+23
-3
lib/banzai/reference_parser/base_parser.rb
lib/banzai/reference_parser/base_parser.rb
+2
-1
spec/lib/banzai/reference_parser/base_parser_spec.rb
spec/lib/banzai/reference_parser/base_parser_spec.rb
+21
-2
No files found.
lib/banzai/reference_parser/base_parser.rb
View file @
e89d4741
...
@@ -136,7 +136,8 @@ module Banzai
...
@@ -136,7 +136,8 @@ module Banzai
nodes
.
each_with_object
({})
do
|
node
,
hash
|
nodes
.
each_with_object
({})
do
|
node
,
hash
|
if
node
.
has_attribute?
(
attribute
)
if
node
.
has_attribute?
(
attribute
)
hash
[
node
]
=
objects_by_id
[
node
.
attr
(
attribute
).
to_i
]
obj
=
objects_by_id
[
node
.
attr
(
attribute
).
to_i
]
hash
[
node
]
=
obj
if
obj
end
end
end
end
end
end
...
...
spec/lib/banzai/reference_parser/base_parser_spec.rb
View file @
e89d4741
...
@@ -114,8 +114,27 @@ describe Banzai::ReferenceParser::BaseParser, lib: true do
...
@@ -114,8 +114,27 @@ describe Banzai::ReferenceParser::BaseParser, lib: true do
expect
(
hash
).
to
eq
({
link
=>
user
})
expect
(
hash
).
to
eq
({
link
=>
user
})
end
end
it
'returns an empty Hash when the list of nodes is empty'
do
it
'returns an empty Hash when entry does not exist in the database'
do
expect
(
subject
.
grouped_objects_for_nodes
([],
User
,
'data-user'
)).
to
eq
({})
link
=
double
(
:link
)
expect
(
link
).
to
receive
(
:has_attribute?
).
with
(
'data-user'
).
and_return
(
true
)
expect
(
link
).
to
receive
(
:attr
).
with
(
'data-user'
).
and_return
(
'1'
)
nodes
=
[
link
]
bad_id
=
user
.
id
+
100
expect
(
subject
).
to
receive
(
:unique_attribute_values
).
with
(
nodes
,
'data-user'
).
and_return
([
bad_id
.
to_s
])
hash
=
subject
.
grouped_objects_for_nodes
(
nodes
,
User
,
'data-user'
)
expect
(
hash
).
to
eq
({})
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