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
aa934c74
Commit
aa934c74
authored
Dec 21, 2016
by
Jarka Kadlecova
Committed by
Jarka Kadlecova
Jan 11, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refresh merge widget after using /merge command
parent
7ab3dd4b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
77 additions
and
0 deletions
+77
-0
notes.js
app/assets/javascripts/notes.js
+12
-0
merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+10
-0
_show.html.haml
app/views/projects/merge_requests/_show.html.haml
+2
-0
project.rb
config/routes/project.rb
+1
-0
merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+52
-0
No files found.
app/assets/javascripts/notes.js
View file @
aa934c74
...
...
@@ -3,6 +3,7 @@
/* global GLForm */
/* global Autosave */
/* global ResolveService */
/* global mrRefreshWidgetUrl */
/*= require autosave */
/*= require autosize */
...
...
@@ -244,6 +245,16 @@
};
Notes
.
prototype
.
handleCreateChanges
=
function
(
note
)
{
if
(
typeof
note
===
'undefined'
)
{
return
;
}
if
(
note
.
commands_changes
&&
note
.
commands_changes
.
includes
(
'merge'
))
{
$
.
get
(
mrRefreshWidgetUrl
);
}
};
/*
Render note in main comments area.
...
...
@@ -429,6 +440,7 @@
*/
Notes
.
prototype
.
addNote
=
function
(
xhr
,
note
,
status
)
{
this
.
handleCreateChanges
(
note
);
return
this
.
renderNote
(
note
);
};
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
aa934c74
...
...
@@ -347,6 +347,16 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
end
def
merge_widget_refresh
if
merge_request
.
in_progress_merge_commit_sha
@status
=
:success
elsif
merge_request
.
merge_when_build_succeeds
@status
=
:merge_when_build_succeeds
end
render
'merge'
end
def
branch_from
# This is always source
@source_project
=
@merge_request
.
nil?
?
@project
:
@merge_request
.
source_project
...
...
app/views/projects/merge_requests/_show.html.haml
View file @
aa934c74
...
...
@@ -112,3 +112,5 @@
merge_request
=
new
MergeRequest
({
action
:
"
#{
controller
.
action_name
}
"
});
var
mrRefreshWidgetUrl
=
"
#{
@merge_request
&&
@merge_request
.
source_project
?
merge_widget_refresh_namespace_project_merge_request_url
(
@merge_request
.
source_project
.
namespace
,
@merge_request
.
source_project
,
@merge_request
)
:
''
}
"
;
config/routes/project.rb
View file @
aa934c74
...
...
@@ -94,6 +94,7 @@ constraints(ProjectUrlConstrainer.new) do
get
:pipelines
get
:merge_check
post
:merge
get
:merge_widget_refresh
post
:cancel_merge_when_build_succeeds
get
:ci_status
get
:ci_environments_status
...
...
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
aa934c74
...
...
@@ -1048,4 +1048,56 @@ describe Projects::MergeRequestsController do
end
end
end
describe
'GET merge_widget_refresh'
do
let
(
:params
)
do
{
namespace_id:
project
.
namespace
.
path
,
project_id:
project
.
path
,
id:
merge_request
.
iid
,
format: :raw
}
end
before
do
project
.
team
<<
[
user
,
:developer
]
xhr
:get
,
:merge_widget_refresh
,
params
end
context
'when merge in progress'
do
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
in_progress_merge_commit_sha:
'sha'
)
}
it
'returns an OK response'
do
expect
(
response
).
to
have_http_status
(
:ok
)
end
it
'returns :success'
do
expect
(
assigns
(
:status
)).
to
eq
(
:success
)
end
end
context
'when waiting for build'
do
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
merge_when_build_succeeds:
true
,
merge_user:
user
)
}
it
'returns an OK response'
do
expect
(
response
).
to
have_http_status
(
:ok
)
end
it
'returns :merge_when_build_succeeds'
do
expect
(
assigns
(
:status
)).
to
eq
(
:merge_when_build_succeeds
)
end
end
context
'when no special status for MR'
do
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
)
}
it
'returns an OK response'
do
expect
(
response
).
to
have_http_status
(
:ok
)
end
it
'returns nil'
do
expect
(
assigns
(
:status
)).
to
be_nil
end
end
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