Commit 59b37aec authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'sh-include-project-path-for-internal-api' into 'master'

Include gl_project_path in API /internal/allowed response

See merge request gitlab-org/gitlab-ce!25314
parents e49ff615 2c15cf47
---
title: Include gl_project_path in API /internal/allowed response
merge_request: 25314
author:
type: other
...@@ -81,6 +81,14 @@ module API ...@@ -81,6 +81,14 @@ module API
Gitlab::GlRepository.gl_repository(project, wiki?) Gitlab::GlRepository.gl_repository(project, wiki?)
end end
def gl_project_path
if wiki?
project.wiki.full_path
else
project.full_path
end
end
# Return the repository depending on whether we want the wiki or the # Return the repository depending on whether we want the wiki or the
# regular repository # regular repository
def repository def repository
......
...@@ -77,6 +77,7 @@ module API ...@@ -77,6 +77,7 @@ module API
when ::Gitlab::GitAccessResult::Success when ::Gitlab::GitAccessResult::Success
payload = { payload = {
gl_repository: gl_repository, gl_repository: gl_repository,
gl_project_path: gl_project_path,
gl_id: Gitlab::GlId.gl_id(user), gl_id: Gitlab::GlId.gl_id(user),
gl_username: user&.username, gl_username: user&.username,
git_config_options: [], git_config_options: [],
......
...@@ -325,6 +325,7 @@ describe API::Internal do ...@@ -325,6 +325,7 @@ describe API::Internal do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
expect(json_response["status"]).to be_truthy expect(json_response["status"]).to be_truthy
expect(json_response["repository_path"]).to eq('/') expect(json_response["repository_path"]).to eq('/')
expect(json_response["gl_project_path"]).to eq(project.wiki.full_path)
expect(json_response["gl_repository"]).to eq("wiki-#{project.id}") expect(json_response["gl_repository"]).to eq("wiki-#{project.id}")
expect(user.reload.last_activity_on).to be_nil expect(user.reload.last_activity_on).to be_nil
end end
...@@ -337,6 +338,7 @@ describe API::Internal do ...@@ -337,6 +338,7 @@ describe API::Internal do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
expect(json_response["status"]).to be_truthy expect(json_response["status"]).to be_truthy
expect(json_response["repository_path"]).to eq('/') expect(json_response["repository_path"]).to eq('/')
expect(json_response["gl_project_path"]).to eq(project.wiki.full_path)
expect(json_response["gl_repository"]).to eq("wiki-#{project.id}") expect(json_response["gl_repository"]).to eq("wiki-#{project.id}")
expect(user.reload.last_activity_on).to eql(Date.today) expect(user.reload.last_activity_on).to eql(Date.today)
end end
...@@ -350,6 +352,7 @@ describe API::Internal do ...@@ -350,6 +352,7 @@ describe API::Internal do
expect(json_response["status"]).to be_truthy expect(json_response["status"]).to be_truthy
expect(json_response["repository_path"]).to eq('/') expect(json_response["repository_path"]).to eq('/')
expect(json_response["gl_repository"]).to eq("project-#{project.id}") expect(json_response["gl_repository"]).to eq("project-#{project.id}")
expect(json_response["gl_project_path"]).to eq(project.full_path)
expect(json_response["gitaly"]).not_to be_nil expect(json_response["gitaly"]).not_to be_nil
expect(json_response["gitaly"]["repository"]).not_to be_nil expect(json_response["gitaly"]["repository"]).not_to be_nil
expect(json_response["gitaly"]["repository"]["storage_name"]).to eq(project.repository.gitaly_repository.storage_name) expect(json_response["gitaly"]["repository"]["storage_name"]).to eq(project.repository.gitaly_repository.storage_name)
...@@ -369,6 +372,7 @@ describe API::Internal do ...@@ -369,6 +372,7 @@ describe API::Internal do
expect(json_response["status"]).to be_truthy expect(json_response["status"]).to be_truthy
expect(json_response["repository_path"]).to eq('/') expect(json_response["repository_path"]).to eq('/')
expect(json_response["gl_repository"]).to eq("project-#{project.id}") expect(json_response["gl_repository"]).to eq("project-#{project.id}")
expect(json_response["gl_project_path"]).to eq(project.full_path)
expect(json_response["gitaly"]).not_to be_nil expect(json_response["gitaly"]).not_to be_nil
expect(json_response["gitaly"]["repository"]).not_to be_nil expect(json_response["gitaly"]["repository"]).not_to be_nil
expect(json_response["gitaly"]["repository"]["storage_name"]).to eq(project.repository.gitaly_repository.storage_name) expect(json_response["gitaly"]["repository"]["storage_name"]).to eq(project.repository.gitaly_repository.storage_name)
......
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