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
379a6a70
Commit
379a6a70
authored
Jun 12, 2018
by
Mario de la Ossa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sidebar Milestone - Fix wrong URL when selecting a parent group milestone
parent
7530e4ec
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
2 deletions
+34
-2
app/assets/javascripts/milestone_select.js
app/assets/javascripts/milestone_select.js
+1
-1
lib/api/entities.rb
lib/api/entities.rb
+4
-0
lib/gitlab/url_builder.rb
lib/gitlab/url_builder.rb
+2
-0
spec/fixtures/api/schemas/public_api/v4/milestones.json
spec/fixtures/api/schemas/public_api/v4/milestones.json
+2
-1
spec/lib/gitlab/url_builder_spec.rb
spec/lib/gitlab/url_builder_spec.rb
+25
-0
No files found.
app/assets/javascripts/milestone_select.js
View file @
379a6a70
...
...
@@ -56,7 +56,7 @@ export default class MilestoneSelect {
if
(
issueUpdateURL
)
{
milestoneLinkTemplate
=
_
.
template
(
'
<a href="
/<%- full_path %>/milestones/<%- iid
%>" class="bold has-tooltip" data-container="body" title="<%- remaining %>"><%- title %></a>
'
,
'
<a href="
<%- web_url
%>" class="bold has-tooltip" data-container="body" title="<%- remaining %>"><%- title %></a>
'
,
);
milestoneLinkNoneTemplate
=
'
<span class="no-value">None</span>
'
;
}
...
...
lib/api/entities.rb
View file @
379a6a70
...
...
@@ -412,6 +412,10 @@ module API
expose
:state
,
:created_at
,
:updated_at
expose
:due_date
expose
:start_date
expose
:web_url
do
|
milestone
,
_options
|
Gitlab
::
UrlBuilder
.
build
(
milestone
)
end
end
class
IssueBasic
<
ProjectEntity
...
...
lib/gitlab/url_builder.rb
View file @
379a6a70
...
...
@@ -26,6 +26,8 @@ module Gitlab
project_snippet_url
(
object
.
project
,
object
)
when
Snippet
snippet_url
(
object
)
when
Milestone
milestone_url
(
object
)
else
raise
NotImplementedError
.
new
(
"No URL builder defined for
#{
object
.
class
}
"
)
end
...
...
spec/fixtures/api/schemas/public_api/v4/milestones.json
View file @
379a6a70
...
...
@@ -13,7 +13,8 @@
"created_at"
:
{
"type"
:
"date"
},
"updated_at"
:
{
"type"
:
"date"
},
"start_date"
:
{
"type"
:
"date"
},
"due_date"
:
{
"type"
:
"date"
}
"due_date"
:
{
"type"
:
"date"
},
"web_url"
:
{
"type"
:
"string"
}
},
"required"
:
[
"id"
,
"iid"
,
"title"
,
"description"
,
"state"
,
...
...
spec/lib/gitlab/url_builder_spec.rb
View file @
379a6a70
...
...
@@ -22,6 +22,31 @@ describe Gitlab::UrlBuilder do
end
end
context
'when passing a Milestone'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
namespace:
group
)
}
context
'belonging to a project'
do
it
'returns a proper URL'
do
milestone
=
create
(
:milestone
,
project:
project
)
url
=
described_class
.
build
(
milestone
)
expect
(
url
).
to
eq
"
#{
Settings
.
gitlab
[
'url'
]
}
/
#{
milestone
.
project
.
full_path
}
/milestones/
#{
milestone
.
iid
}
"
end
end
context
'belonging to a group'
do
it
'returns a proper URL'
do
milestone
=
create
(
:milestone
,
group:
group
)
url
=
described_class
.
build
(
milestone
)
expect
(
url
).
to
eq
"
#{
Settings
.
gitlab
[
'url'
]
}
/groups/
#{
milestone
.
group
.
full_path
}
/-/milestones/
#{
milestone
.
iid
}
"
end
end
end
context
'when passing a MergeRequest'
do
it
'returns a proper URL'
do
merge_request
=
build_stubbed
(
:merge_request
,
iid:
42
)
...
...
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