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
Jérome Perrin
gitlab-ce
Commits
715959e5
Commit
715959e5
authored
Apr 23, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix cross-project milestone ref with invalid project
parent
ab1734f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
11 deletions
+17
-11
lib/banzai/filter/milestone_reference_filter.rb
lib/banzai/filter/milestone_reference_filter.rb
+17
-11
No files found.
lib/banzai/filter/milestone_reference_filter.rb
View file @
715959e5
...
...
@@ -17,9 +17,7 @@ module Banzai
return
super
(
text
,
pattern
)
if
pattern
!=
Milestone
.
reference_pattern
text
.
gsub
(
pattern
)
do
|
match
|
project
=
project_from_ref
(
$~
[
:project
])
params
=
milestone_params
(
$~
[
:milestone_iid
].
to_i
,
$~
[
:milestone_name
])
milestone
=
project
.
milestones
.
find_by
(
params
)
milestone
=
find_milestone
(
$~
[
:project
],
$~
[
:milestone_iid
],
$~
[
:milestone_name
])
if
milestone
yield
match
,
milestone
.
iid
,
$~
[
:project
],
$~
...
...
@@ -29,6 +27,22 @@ module Banzai
end
end
def
find_milestone
(
project_ref
,
milestone_id
,
milestone_name
)
project
=
project_from_ref
(
project_ref
)
return
unless
project
milestone_params
=
milestone_params
(
milestone_id
,
milestone_name
)
project
.
milestones
.
find_by
(
milestone_params
)
end
def
milestone_params
(
iid
,
name
)
if
name
{
name:
name
.
tr
(
'"'
,
''
)
}
else
{
iid:
iid
.
to_i
}
end
end
def
url_for_object
(
milestone
,
project
)
h
=
Gitlab
::
Routing
.
url_helpers
h
.
namespace_project_milestone_url
(
project
.
namespace
,
project
,
milestone
,
...
...
@@ -43,14 +57,6 @@ module Banzai
html_safe
end
end
def
milestone_params
(
iid
,
name
)
if
name
{
name:
name
.
tr
(
'"'
,
''
)
}
else
{
iid:
iid
}
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