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
ea5c25bb
Commit
ea5c25bb
authored
Sep 18, 2015
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove milestones from merge requests when milestones are deleted
Reported by
https://github.com/gitlabhq/gitlabhq/issues/9643
parent
abaa65ef
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
0 deletions
+12
-0
CHANGELOG
CHANGELOG
+1
-0
destroy_service.rb
app/services/milestones/destroy_service.rb
+5
-0
milestones_controller_spec.rb
spec/controllers/projects/milestones_controller_spec.rb
+6
-0
No files found.
CHANGELOG
View file @
ea5c25bb
...
...
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.0.0 (unreleased)
- Fix Markdown links not showing up in dashboard activity feed (Stan Hu)
- Remove milestones from merge requests when milestones are deleted (Stan Hu)
- Fix HTML link that was improperly escaped in new user e-mail (Stan Hu)
- Fix broken sort in merge request API (Stan Hu)
- Bump rouge to 1.10.1 to remove warning noise and fix other syntax highlighting bugs (Stan Hu)
...
...
app/services/milestones/destroy_service.rb
View file @
ea5c25bb
...
...
@@ -4,10 +4,15 @@ module Milestones
Milestone
.
transaction
do
update_params
=
{
milestone:
nil
}
milestone
.
issues
.
each
do
|
issue
|
Issues
::
UpdateService
.
new
(
project
,
current_user
,
update_params
).
execute
(
issue
)
end
milestone
.
merge_requests
.
each
do
|
merge_request
|
MergeRequests
::
UpdateService
.
new
(
project
,
current_user
,
update_params
).
execute
(
merge_request
)
end
event_service
.
destroy_milestone
(
milestone
,
current_user
)
Event
.
for_milestone_id
(
milestone
.
id
).
each
do
|
event
|
...
...
spec/controllers/projects/milestones_controller_spec.rb
View file @
ea5c25bb
...
...
@@ -5,6 +5,7 @@ describe Projects::MilestonesController do
let
(
:user
)
{
create
(
:user
)
}
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
milestone:
milestone
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
,
milestone:
milestone
)
}
before
do
sign_in
(
user
)
...
...
@@ -14,6 +15,7 @@ describe Projects::MilestonesController do
describe
"#destroy"
do
it
"should remove milestone"
do
merge_request
.
reload
expect
(
issue
.
milestone_id
).
to
eq
(
milestone
.
id
)
delete
:destroy
,
namespace_id:
project
.
namespace
.
id
,
project_id:
project
.
id
,
id:
milestone
.
id
,
format: :js
...
...
@@ -24,6 +26,10 @@ describe Projects::MilestonesController do
expect
{
Milestone
.
find
(
milestone
.
id
)
}.
to
raise_exception
(
ActiveRecord
::
RecordNotFound
)
issue
.
reload
expect
(
issue
.
milestone_id
).
to
eq
(
nil
)
merge_request
.
reload
expect
(
merge_request
.
milestone_id
).
to
eq
(
nil
)
# Check system note left for milestone removal
last_note
=
project
.
issues
.
find
(
issue
.
id
).
notes
[
-
1
].
note
expect
(
last_note
).
to
eq
(
'Milestone removed'
)
...
...
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