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
Léo-Paul Géneau
gitlab-ce
Commits
46278ec7
Commit
46278ec7
authored
Dec 07, 2015
by
Zeger-Jan van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Button fix
parent
2462a96e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
9 deletions
+34
-9
app/services/system_note_service.rb
app/services/system_note_service.rb
+1
-1
app/views/projects/merge_requests/widget/open/_accept.html.haml
...ews/projects/merge_requests/widget/open/_accept.html.haml
+29
-4
spec/features/merge_requests/merge_when_build_succeeds_spec.rb
...features/merge_requests/merge_when_build_succeeds_spec.rb
+1
-1
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+1
-1
spec/services/merge_requests/merge_when_build_succeeds_service_spec.rb
.../merge_requests/merge_when_build_succeeds_service_spec.rb
+1
-1
spec/services/system_note_service_spec.rb
spec/services/system_note_service_spec.rb
+1
-1
No files found.
app/services/system_note_service.rb
View file @
46278ec7
...
...
@@ -139,7 +139,7 @@ class SystemNoteService
# Called when 'merge when build succeeds' is canceled
def
self
.
cancel_merge_when_build_succeeds
(
noteable
,
project
,
author
)
body
=
"Cancel
l
ed the automatic merge"
body
=
"Canceled the automatic merge"
create_note
(
noteable:
noteable
,
project:
project
,
author:
author
,
note:
body
)
end
...
...
app/views/projects/merge_requests/widget/open/_accept.html.haml
View file @
46278ec7
...
...
@@ -5,10 +5,22 @@
.accept-merge-holder.clearfix.js-toggle-container
.accept-action
-
if
@merge_request
.
ci_commit
&&
@merge_request
.
ci_commit
.
active?
=
f
.
button
class:
"btn btn-create btn-grouped merge_when_build_succeeds"
,
name:
"merge_when_build_succeeds"
do
Merge When Build Succeeds
=
f
.
button
class:
"btn btn-create btn-grouped accept_merge_request
#{
status_class
}
"
do
Accept Merge Request Now
%span
.btn-group
=
link_to
"#"
,
class:
"btn btn-create merge_when_build_succeeds"
do
Merge When Build Succeeds
%a
.btn.btn-success.dropdown-toggle
{
'data-toggle'
=>
'dropdown'
}
%span
.caret
%span
.sr-only
Select Merge Moment
%ul
.dropdown-menu.dropdown-menu-right
{
role:
'menu'
}
%li
=
link_to
"#"
,
class:
"merge_when_build_succeeds"
do
=
icon
(
'check fw'
)
Merge When Build Succeeds
%li
=
link_to
"#"
,
class:
"accept_merge_request"
do
=
icon
(
'warning fw'
)
Accept Merge Request Now
-
else
=
f
.
button
class:
"btn btn-create btn-grouped accept_merge_request
#{
status_class
}
"
do
Accept Merge Request
...
...
@@ -26,6 +38,8 @@
text:
@merge_request
.
merge_commit_message
,
rows:
14
,
hint:
true
=
hidden_field_tag
:merge_when_build_succeeds
,
""
:javascript
$
(
'
.accept_merge_request
'
).
on
(
'
click
'
,
function
()
{
$
(
this
).
html
(
"
<i class='fa fa-spinner fa-spin'></i> Merge in progress
"
);
...
...
@@ -34,3 +48,14 @@
$
(
'
.accept-mr-form
'
).
on
(
'
ajax:send
'
,
function
()
{
$
(
"
.accept-mr-form :input
"
).
disable
();
});
$
(
'
a.accept_merge_request
'
).
on
(
'
click
'
,
function
(
e
)
{
e
.
preventDefault
();
$
(
this
).
closest
(
"
form
"
).
submit
();
});
$
(
'
a.merge_when_build_succeeds
'
).
on
(
'
click
'
,
function
(
e
)
{
e
.
preventDefault
();
$
(
"
#merge_when_build_succeeds
"
).
val
(
"
1
"
);
$
(
this
).
closest
(
"
form
"
).
submit
();
});
spec/features/merge_requests/merge_when_build_succeeds_spec.rb
View file @
46278ec7
...
...
@@ -68,7 +68,7 @@ feature 'Merge When Build Succeeds', feature: true, js: true do
expect
(
page
).
to
have_button
"Merge When Build Succeeds"
visit_merge_request
(
merge_request
)
# Needed to refresh the page
expect
(
page
).
to
have_content
"Cancel
l
ed the automatic merge"
expect
(
page
).
to
have_content
"Canceled the automatic merge"
end
it
"allows the user to remove the source branch"
do
...
...
spec/models/merge_request_spec.rb
View file @
46278ec7
...
...
@@ -192,7 +192,7 @@ describe MergeRequest do
end
end
describe
'#can_remove_source_branch'
do
describe
'#can_remove_source_branch
?
'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
...
...
spec/services/merge_requests/merge_when_build_succeeds_service_spec.rb
View file @
46278ec7
...
...
@@ -78,7 +78,7 @@ describe MergeRequests::MergeWhenBuildSucceedsService do
it
'Posts a system note'
do
note
=
mr_merge_if_green_enabled
.
notes
.
last
expect
(
note
.
note
).
to
include
'Cancel
l
ed the automatic merge'
expect
(
note
.
note
).
to
include
'Canceled the automatic merge'
end
end
end
spec/services/system_note_service_spec.rb
View file @
46278ec7
...
...
@@ -229,7 +229,7 @@ describe SystemNoteService do
it_behaves_like
'a system note'
it
"posts the Merge When Build Succeeds system note"
do
expect
(
subject
.
note
).
to
eq
"Cancel
l
ed the automatic merge"
expect
(
subject
.
note
).
to
eq
"Canceled the automatic merge"
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