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
15b17b3f
Commit
15b17b3f
authored
Jun 09, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement approve button
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
73faf3c7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
28 deletions
+63
-28
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+9
-1
app/views/projects/merge_requests/show/_mr_accept.html.haml
app/views/projects/merge_requests/show/_mr_accept.html.haml
+32
-27
config/routes.rb
config/routes.rb
+1
-0
features/project/merge_requests.feature
features/project/merge_requests.feature
+6
-0
features/steps/project/merge_requests.rb
features/steps/project/merge_requests.rb
+15
-0
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
15b17b3f
...
...
@@ -4,7 +4,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
before_action
:module_enabled
before_action
:merge_request
,
only:
[
:edit
,
:update
,
:show
,
:diffs
,
:commits
,
:automerge
,
:automerge_check
,
:ci_status
,
:toggle_subscription
:ci_status
,
:toggle_subscription
,
:approve
]
before_action
:closes_issues
,
only:
[
:edit
,
:update
,
:show
,
:diffs
,
:commits
]
before_action
:validates_merge_request
,
only:
[
:show
,
:diffs
,
:commits
]
...
...
@@ -195,6 +195,14 @@ class Projects::MergeRequestsController < Projects::ApplicationController
render
nothing:
true
end
def
approve
@approval
=
@merge_request
.
approvals
.
new
@approval
.
user
=
current_user
@approval
.
save
redirect_to
merge_request_path
(
@merge_request
)
end
protected
def
selected_target_project
...
...
app/views/projects/merge_requests/show/_mr_accept.html.haml
View file @
15b17b3f
...
...
@@ -17,34 +17,39 @@
-
if
@show_merge_controls
.automerge_widget.can_be_merged.hide
.clearfix
=
form_for
[
:automerge
,
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
@merge_request
],
remote:
true
,
method: :post
do
|
f
|
.accept-merge-holder.clearfix.js-toggle-container
.accept-action
=
f
.
submit
"Accept Merge Request"
,
class:
"btn btn-create accept_merge_request"
-
if
can_remove_branch?
(
@merge_request
.
source_project
,
@merge_request
.
source_branch
)
&&
!
@merge_request
.
for_fork?
.accept-control.checkbox
=
label_tag
:should_remove_source_branch
,
class:
"remove_source_checkbox"
do
=
check_box_tag
:should_remove_source_branch
Remove source-branch
-
if
@merge_request
.
target_project
.
merge_requests_rebase_enabled
&&
can_rebase?
(
@merge_request
.
target_project
,
@merge_request
.
target_branch
)
.accept-control.remove_branch_holder
=
label_tag
:should_rebase
,
class:
"checkbox"
do
=
check_box_tag
:should_rebase
,
"1"
,
@project
.
merge_requests_rebase_default
Rebase before merge
.accept-control
=
link_to
"#"
,
class:
"modify-merge-commit-link js-toggle-button"
,
title:
"Modify merge commit message"
do
%i
.fa.fa-edit
Modify commit message
.js-toggle-content.hide.prepend-top-20
=
render
'shared/commit_message_container'
,
params:
params
,
text:
@merge_request
.
merge_commit_message
,
rows:
14
,
hint:
true
-
if
@merge_request
.
requires_approve?
=
form_for
[
:approve
,
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
@merge_request
],
method: :post
do
|
f
|
%p
This merge request must be approved by
#{
pluralize
(
@merge_request
.
approvals_left
,
'user'
)
}
before it can be merged
=
f
.
submit
"Approve Merge Request"
,
class:
"btn btn-reopen"
-
else
=
form_for
[
:automerge
,
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
@merge_request
],
remote:
true
,
method: :post
do
|
f
|
.accept-merge-holder.clearfix.js-toggle-container
.accept-action
=
f
.
submit
"Accept Merge Request"
,
class:
"btn btn-create accept_merge_request"
-
if
can_remove_branch?
(
@merge_request
.
source_project
,
@merge_request
.
source_branch
)
&&
!
@merge_request
.
for_fork?
.accept-control.checkbox
=
label_tag
:should_remove_source_branch
,
class:
"remove_source_checkbox"
do
=
check_box_tag
:should_remove_source_branch
Remove source-branch
-
if
@merge_request
.
target_project
.
merge_requests_rebase_enabled
&&
can_rebase?
(
@merge_request
.
target_project
,
@merge_request
.
target_branch
)
.accept-control.remove_branch_holder
=
label_tag
:should_rebase
,
class:
"checkbox"
do
=
check_box_tag
:should_rebase
,
"1"
,
@project
.
merge_requests_rebase_default
Rebase before merge
.accept-control
=
link_to
"#"
,
class:
"modify-merge-commit-link js-toggle-button"
,
title:
"Modify merge commit message"
do
%i
.fa.fa-edit
Modify commit message
.js-toggle-content.hide.prepend-top-20
=
render
'shared/commit_message_container'
,
params:
params
,
text:
@merge_request
.
merge_commit_message
,
rows:
14
,
hint:
true
%br
.light
If you want to merge this request manually, you can use the
%strong
=
link_to
"command line"
,
"#modal_merge_info"
,
class:
"how_to_merge_link vlink"
,
title:
"How To Merge"
,
"data-toggle"
=>
"modal"
%br
.light
If you want to merge this request manually, you can use the
%strong
=
link_to
"command line"
,
"#modal_merge_info"
,
class:
"how_to_merge_link vlink"
,
title:
"How To Merge"
,
"data-toggle"
=>
"modal"
.automerge_widget.no_satellite.hide
...
...
config/routes.rb
View file @
15b17b3f
...
...
@@ -491,6 +491,7 @@ Gitlab::Application.routes.draw do
get
:automerge_check
get
:ci_status
post
:toggle_subscription
post
:approve
end
collection
do
...
...
features/project/merge_requests.feature
View file @
15b17b3f
...
...
@@ -220,3 +220,9 @@ Feature: Project Merge Requests
When
I click the
"Target branch"
dropdown
And
I select a new target branch
Then
I should see new target branch changes
Scenario
:
I
approve merge request
Given
merge request 'Bug NS-04' must be approved
Given
I click link
"Bug NS-04"
And
I click link
"Approve"
Then
I should see approved merge request
"Bug NS-04"
features/steps/project/merge_requests.rb
View file @
15b17b3f
...
...
@@ -329,6 +329,21 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
page
.
should
have_content
'Target branch changed from master to feature'
end
step
'merge request \'Bug NS-04\' must be approved'
do
merge_request
=
MergeRequest
.
find_by!
(
title:
"Bug NS-04"
)
project
=
merge_request
.
target_project
project
.
approvals_before_merge
=
1
project
.
save!
end
step
'I click link "Approve"'
do
click_button
'Approve Merge Request'
end
step
'I should see approved merge request "Bug NS-04"'
do
page
.
should
have_button
(
"Accept Merge Request"
)
end
def
merge_request
@merge_request
||=
MergeRequest
.
find_by!
(
title:
"Bug NS-05"
)
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