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
Boxiang Sun
gitlab-ce
Commits
6d49fcf4
Commit
6d49fcf4
authored
Sep 22, 2016
by
Tony Gambone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Close todos when accepting a MR via the API.
parent
923a1f7a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
8 deletions
+32
-8
CHANGELOG
CHANGELOG
+1
-0
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+0
-2
app/services/merge_requests/post_merge_service.rb
app/services/merge_requests/post_merge_service.rb
+1
-0
spec/services/merge_requests/merge_service_spec.rb
spec/services/merge_requests/merge_service_spec.rb
+24
-0
spec/services/merge_requests/refresh_service_spec.rb
spec/services/merge_requests/refresh_service_spec.rb
+6
-6
No files found.
CHANGELOG
View file @
6d49fcf4
...
...
@@ -20,6 +20,7 @@ v 8.13.0 (unreleased)
- Optimize GitHub importing for speed and memory
- API: expose pipeline data in builds API (!6502, Guilherme Salazar)
- Fix broken repository 500 errors in project list
- Close todos when accepting merge requests via the API !6486 (tonygambone)
v 8.12.2 (unreleased)
- Added University content to doc/university
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
6d49fcf4
...
...
@@ -308,8 +308,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
return
end
TodoService
.
new
.
merge_merge_request
(
merge_request
,
current_user
)
@merge_request
.
update
(
merge_error:
nil
)
if
params
[
:merge_when_build_succeeds
].
present?
...
...
app/services/merge_requests/post_merge_service.rb
View file @
6d49fcf4
...
...
@@ -7,6 +7,7 @@ module MergeRequests
class
PostMergeService
<
MergeRequests
::
BaseService
def
execute
(
merge_request
)
close_issues
(
merge_request
)
todo_service
.
merge_merge_request
(
merge_request
,
current_user
)
merge_request
.
mark_as_merged
create_merge_event
(
merge_request
,
current_user
)
create_note
(
merge_request
)
...
...
spec/services/merge_requests/merge_service_spec.rb
View file @
6d49fcf4
...
...
@@ -38,6 +38,30 @@ describe MergeRequests::MergeService, services: true do
end
end
context
'closes related todos'
do
let
(
:merge_request
)
{
create
(
:merge_request
,
assignee:
user
,
author:
user
)
}
let
(
:project
)
{
merge_request
.
project
}
let
(
:service
)
{
MergeRequests
::
MergeService
.
new
(
project
,
user
,
commit_message:
'Awesome message'
)
}
let!
(
:todo
)
do
create
(
:todo
,
:assigned
,
project:
project
,
author:
user
,
user:
user
,
target:
merge_request
)
end
before
do
allow
(
service
).
to
receive
(
:execute_hooks
)
perform_enqueued_jobs
do
service
.
execute
(
merge_request
)
todo
.
reload
end
end
it
{
expect
(
todo
).
to
be_done
}
end
context
'remove source branch by author'
do
let
(
:service
)
do
merge_request
.
merge_params
[
'force_remove_source_branch'
]
=
'1'
...
...
spec/services/merge_requests/refresh_service_spec.rb
View file @
6d49fcf4
...
...
@@ -79,8 +79,8 @@ describe MergeRequests::RefreshService, services: true do
it
{
expect
(
@merge_request
).
to
be_merged
}
it
{
expect
(
@fork_merge_request
).
to
be_merged
}
it
{
expect
(
@fork_merge_request
.
notes
.
last
.
note
).
to
include
(
'changed to merged'
)
}
it
{
expect
(
@build_failed_todo
).
to
be_
pending
}
it
{
expect
(
@fork_build_failed_todo
).
to
be_
pending
}
it
{
expect
(
@build_failed_todo
).
to
be_
done
}
it
{
expect
(
@fork_build_failed_todo
).
to
be_
done
}
end
context
'manual merge of source branch'
do
...
...
@@ -99,8 +99,8 @@ describe MergeRequests::RefreshService, services: true do
it
{
expect
(
@merge_request
.
diffs
.
size
).
to
be
>
0
}
it
{
expect
(
@fork_merge_request
).
to
be_merged
}
it
{
expect
(
@fork_merge_request
.
notes
.
last
.
note
).
to
include
(
'changed to merged'
)
}
it
{
expect
(
@build_failed_todo
).
to
be_
pending
}
it
{
expect
(
@fork_build_failed_todo
).
to
be_
pending
}
it
{
expect
(
@build_failed_todo
).
to
be_
done
}
it
{
expect
(
@fork_build_failed_todo
).
to
be_
done
}
end
context
'push to fork repo source branch'
do
...
...
@@ -149,8 +149,8 @@ describe MergeRequests::RefreshService, services: true do
it
{
expect
(
@merge_request
).
to
be_merged
}
it
{
expect
(
@fork_merge_request
).
to
be_open
}
it
{
expect
(
@fork_merge_request
.
notes
).
to
be_empty
}
it
{
expect
(
@build_failed_todo
).
to
be_
pending
}
it
{
expect
(
@fork_build_failed_todo
).
to
be_
pending
}
it
{
expect
(
@build_failed_todo
).
to
be_
done
}
it
{
expect
(
@fork_build_failed_todo
).
to
be_
done
}
end
context
'push new branch that exists in a merge request'
do
...
...
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