Commit b7287fac authored by Bob Van Landuyt's avatar Bob Van Landuyt Committed by Jan Provaznik

Remove the `/merge_request_urls` from internal API

This was added in
https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/5542 but has
been replaced by the post receive call in https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/13916
parent 3ccba772
...@@ -115,16 +115,6 @@ curl --request POST --header "Gitlab-Shared-Secret: <Base64 encoded token>" --da ...@@ -115,16 +115,6 @@ curl --request POST --header "Gitlab-Shared-Secret: <Base64 encoded token>" --da
- GitLab-shell - GitLab-shell
## Get merge requests for a ref [NOT USED]
```
GET /internal/merge_request_urls
```
**Deprecated**: This used to be called from GitLab shell to fetch the
merge requests for a change to output them after a push, but this is
now handled in the `/internal/post_receive` call.
## Authorized Keys Check ## Authorized Keys Check
This endpoint is called by the GitLab-shell authorized keys This endpoint is called by the GitLab-shell authorized keys
......
...@@ -112,10 +112,6 @@ module API ...@@ -112,10 +112,6 @@ module API
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
get "/merge_request_urls" do
merge_request_urls
end
# #
# Get a ssh key using the fingerprint # Get a ssh key using the fingerprint
# #
......
...@@ -770,47 +770,6 @@ describe API::Internal::Base do ...@@ -770,47 +770,6 @@ describe API::Internal::Base do
end end
end end
describe 'GET /internal/merge_request_urls' do
let(:repo_name) { "#{project.full_path}" }
let(:changes) { URI.escape("#{Gitlab::Git::BLANK_SHA} 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/new_branch") }
before do
project.add_developer(user)
end
it 'returns link to create new merge request' do
get api("/internal/merge_request_urls?project=#{repo_name}&changes=#{changes}"), params: { secret_token: secret_token }
expect(json_response).to match [{
"branch_name" => "new_branch",
"url" => "http://#{Gitlab.config.gitlab.host}/#{project.full_path}/merge_requests/new?merge_request%5Bsource_branch%5D=new_branch",
"new_merge_request" => true
}]
end
it 'returns empty array if printing_merge_request_link_enabled is false' do
project.update!(printing_merge_request_link_enabled: false)
get api("/internal/merge_request_urls?project=#{repo_name}&changes=#{changes}"), params: { secret_token: secret_token }
expect(json_response).to eq([])
end
context 'with a gl_repository parameter' do
let(:gl_repository) { "project-#{project.id}" }
it 'returns link to create new merge request' do
get api("/internal/merge_request_urls?gl_repository=#{gl_repository}&changes=#{changes}"), params: { secret_token: secret_token }
expect(json_response).to match [{
"branch_name" => "new_branch",
"url" => "http://#{Gitlab.config.gitlab.host}/#{project.full_path}/merge_requests/new?merge_request%5Bsource_branch%5D=new_branch",
"new_merge_request" => true
}]
end
end
end
# TODO: Uncomment when the end-point is reenabled # TODO: Uncomment when the end-point is reenabled
# describe 'POST /notify_post_receive' do # describe 'POST /notify_post_receive' do
# let(:valid_params) do # let(:valid_params) do
...@@ -951,6 +910,19 @@ describe API::Internal::Base do ...@@ -951,6 +910,19 @@ describe API::Internal::Base do
expect(json_response['messages']).to include(build_basic_message(message)) expect(json_response['messages']).to include(build_basic_message(message))
end end
it 'returns the link to an existing merge request when it exists' do
merge_request = create(:merge_request, source_project: project, source_branch: branch_name, target_branch: 'master')
post api('/internal/post_receive'), params: valid_params
message = <<~MESSAGE.strip
View merge request for feature:
#{project_merge_request_url(project, merge_request)}
MESSAGE
expect(json_response['messages']).to include(build_basic_message(message))
end
it 'returns no merge request messages if printing_merge_request_link_enabled is false' do it 'returns no merge request messages if printing_merge_request_link_enabled is false' do
project.update!(printing_merge_request_link_enabled: false) project.update!(printing_merge_request_link_enabled: false)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment