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
e8841e8d
Commit
e8841e8d
authored
May 18, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop merge_check endpoint and use only MR show instead
parent
e4eec191
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
9 deletions
+20
-9
app/assets/javascripts/vue_merge_request_widget/services/mr_widget_service.js
...ts/vue_merge_request_widget/services/mr_widget_service.js
+1
-1
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+10
-8
spec/controllers/projects/merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+9
-0
No files found.
app/assets/javascripts/vue_merge_request_widget/services/mr_widget_service.js
View file @
e8841e8d
...
@@ -6,7 +6,7 @@ Vue.use(VueResource);
...
@@ -6,7 +6,7 @@ Vue.use(VueResource);
export
default
class
MRWidgetService
{
export
default
class
MRWidgetService
{
constructor
(
endpoints
)
{
constructor
(
endpoints
)
{
this
.
mergeResource
=
Vue
.
resource
(
endpoints
.
mergePath
);
this
.
mergeResource
=
Vue
.
resource
(
endpoints
.
mergePath
);
this
.
mergeCheckResource
=
Vue
.
resource
(
endpoints
.
mergeCheck
Path
);
this
.
mergeCheckResource
=
Vue
.
resource
(
endpoints
.
status
Path
);
this
.
cancelAutoMergeResource
=
Vue
.
resource
(
endpoints
.
cancelAutoMergePath
);
this
.
cancelAutoMergeResource
=
Vue
.
resource
(
endpoints
.
cancelAutoMergePath
);
this
.
removeWIPResource
=
Vue
.
resource
(
endpoints
.
removeWIPPath
);
this
.
removeWIPResource
=
Vue
.
resource
(
endpoints
.
removeWIPPath
);
this
.
removeSourceBranchResource
=
Vue
.
resource
(
endpoints
.
sourceBranchPath
);
this
.
removeSourceBranchResource
=
Vue
.
resource
(
endpoints
.
sourceBranchPath
);
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
e8841e8d
...
@@ -9,14 +9,15 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -9,14 +9,15 @@ class Projects::MergeRequestsController < Projects::ApplicationController
before_action
:module_enabled
before_action
:module_enabled
before_action
:merge_request
,
only:
[
before_action
:merge_request
,
only:
[
:edit
,
:update
,
:show
,
:diffs
,
:commits
,
:conflicts
,
:conflict_for_path
,
:pipelines
,
:merge
,
:merge_check
,
:edit
,
:update
,
:show
,
:diffs
,
:commits
,
:conflicts
,
:conflict_for_path
,
:pipelines
,
:merge
,
:pipeline_status
,
:ci_environments_status
,
:toggle_subscription
,
:cancel_merge_when_pipeline_succeeds
,
:remove_wip
,
:resolve_conflicts
,
:assign_related_issues
,
:commit_change_content
:pipeline_status
,
:ci_environments_status
,
:toggle_subscription
,
:cancel_merge_when_pipeline_succeeds
,
:remove_wip
,
:resolve_conflicts
,
:assign_related_issues
,
:commit_change_content
]
]
before_action
:validates_merge_request
,
only:
[
:show
,
:diffs
,
:commits
,
:pipelines
]
before_action
:validates_merge_request
,
only:
[
:show
,
:diffs
,
:commits
,
:pipelines
]
before_action
:define_show_vars
,
only:
[
:
show
,
:
diffs
,
:commits
,
:conflicts
,
:conflict_for_path
,
:builds
,
:pipelines
]
before_action
:define_show_vars
,
only:
[
:diffs
,
:commits
,
:conflicts
,
:conflict_for_path
,
:builds
,
:pipelines
]
before_action
:define_commit_vars
,
only:
[
:diffs
]
before_action
:define_commit_vars
,
only:
[
:diffs
]
before_action
:ensure_ref_fetched
,
only:
[
:show
,
:diffs
,
:commits
,
:builds
,
:conflicts
,
:conflict_for_path
,
:pipelines
]
before_action
:ensure_ref_fetched
,
only:
[
:show
,
:diffs
,
:commits
,
:builds
,
:conflicts
,
:conflict_for_path
,
:pipelines
]
before_action
:close_merge_request_without_source_project
,
only:
[
:show
,
:diffs
,
:commits
,
:builds
,
:pipelines
]
before_action
:close_merge_request_without_source_project
,
only:
[
:show
,
:diffs
,
:commits
,
:builds
,
:pipelines
]
before_action
:check_if_can_be_merged
,
only: :show
before_action
:apply_diff_view_cookie!
,
only:
[
:new_diffs
]
before_action
:apply_diff_view_cookie!
,
only:
[
:new_diffs
]
before_action
:build_merge_request
,
only:
[
:new
,
:new_diffs
]
before_action
:build_merge_request
,
only:
[
:new
,
:new_diffs
]
...
@@ -75,9 +76,12 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -75,9 +76,12 @@ class Projects::MergeRequestsController < Projects::ApplicationController
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
do
format
.
html
do
define_discussion_vars
define_discussion_vars
define_show_vars
end
end
format
.
json
do
format
.
json
do
Gitlab
::
PollingInterval
.
set_header
(
response
,
interval:
10_000
)
render
json:
serializer
.
represent
(
@merge_request
,
basic:
params
[
:basic
])
render
json:
serializer
.
represent
(
@merge_request
,
basic:
params
[
:basic
])
end
end
...
@@ -309,12 +313,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -309,12 +313,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
render
json:
serializer
.
represent
(
@merge_request
)
render
json:
serializer
.
represent
(
@merge_request
)
end
end
def
merge_check
@merge_request
.
check_if_can_be_merged
render
json:
serializer
.
represent
(
@merge_request
)
end
def
commit_change_content
def
commit_change_content
render
partial:
'projects/merge_requests/widget/commit_change_content'
,
layout:
false
render
partial:
'projects/merge_requests/widget/commit_change_content'
,
layout:
false
end
end
...
@@ -640,6 +638,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -640,6 +638,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController
private
private
def
check_if_can_be_merged
@merge_request
.
check_if_can_be_merged
end
def
merge!
def
merge!
# Disable the CI check if merge_when_pipeline_succeeds is enabled since we have
# Disable the CI check if merge_when_pipeline_succeeds is enabled since we have
# to wait until CI completes to know
# to wait until CI completes to know
...
...
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
e8841e8d
...
@@ -119,6 +119,15 @@ describe Projects::MergeRequestsController do
...
@@ -119,6 +119,15 @@ describe Projects::MergeRequestsController do
expect
(
response
).
to
match_response_schema
(
'entities/merge_request'
)
expect
(
response
).
to
match_response_schema
(
'entities/merge_request'
)
end
end
end
end
context
'number of queries'
do
it
'verifies number of queries'
do
recorded
=
ActiveRecord
::
QueryRecorder
.
new
{
go
(
format: :json
)
}
expect
(
recorded
.
count
).
to
be_within
(
1
).
of
(
94
)
expect
(
recorded
.
cached_count
).
to
eq
(
0
)
end
end
end
end
describe
"as diff"
do
describe
"as diff"
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