Commit 2f06369a authored by Alex Pooley's avatar Alex Pooley Committed by Kamil Trzciński

Resolve "Add can_create_merge_request_in to Project API response"

parent b88f2bec
---
title: Add can_create_merge_request_in to /project/:id API response
merge_request: 23577
author:
type: added
...@@ -129,6 +129,7 @@ When the user is authenticated and `simple` is not set this returns something li ...@@ -129,6 +129,7 @@ When the user is authenticated and `simple` is not set this returns something li
"jobs_enabled": true, "jobs_enabled": true,
"wiki_enabled": true, "wiki_enabled": true,
"snippets_enabled": false, "snippets_enabled": false,
"can_create_merge_request_in": true,
"resolve_outdated_diff_discussions": false, "resolve_outdated_diff_discussions": false,
"container_registry_enabled": false, "container_registry_enabled": false,
"created_at": "2013-09-30T13:46:02Z", "created_at": "2013-09-30T13:46:02Z",
...@@ -205,6 +206,7 @@ When the user is authenticated and `simple` is not set this returns something li ...@@ -205,6 +206,7 @@ When the user is authenticated and `simple` is not set this returns something li
"jobs_enabled": true, "jobs_enabled": true,
"wiki_enabled": true, "wiki_enabled": true,
"snippets_enabled": false, "snippets_enabled": false,
"can_create_merge_request_in": true,
"resolve_outdated_diff_discussions": false, "resolve_outdated_diff_discussions": false,
"container_registry_enabled": false, "container_registry_enabled": false,
"created_at": "2013-09-30T13:46:02Z", "created_at": "2013-09-30T13:46:02Z",
...@@ -371,6 +373,7 @@ This endpoint supports [keyset pagination](README.md#keyset-based-pagination) fo ...@@ -371,6 +373,7 @@ This endpoint supports [keyset pagination](README.md#keyset-based-pagination) fo
"jobs_enabled": true, "jobs_enabled": true,
"wiki_enabled": true, "wiki_enabled": true,
"snippets_enabled": false, "snippets_enabled": false,
"can_create_merge_request_in": true,
"resolve_outdated_diff_discussions": false, "resolve_outdated_diff_discussions": false,
"container_registry_enabled": false, "container_registry_enabled": false,
"created_at": "2013-09-30T13:46:02Z", "created_at": "2013-09-30T13:46:02Z",
...@@ -447,6 +450,7 @@ This endpoint supports [keyset pagination](README.md#keyset-based-pagination) fo ...@@ -447,6 +450,7 @@ This endpoint supports [keyset pagination](README.md#keyset-based-pagination) fo
"jobs_enabled": true, "jobs_enabled": true,
"wiki_enabled": true, "wiki_enabled": true,
"snippets_enabled": false, "snippets_enabled": false,
"can_create_merge_request_in": true,
"resolve_outdated_diff_discussions": false, "resolve_outdated_diff_discussions": false,
"container_registry_enabled": false, "container_registry_enabled": false,
"created_at": "2013-09-30T13:46:02Z", "created_at": "2013-09-30T13:46:02Z",
...@@ -584,6 +588,7 @@ Example response: ...@@ -584,6 +588,7 @@ Example response:
"jobs_enabled": true, "jobs_enabled": true,
"wiki_enabled": true, "wiki_enabled": true,
"snippets_enabled": false, "snippets_enabled": false,
"can_create_merge_request_in": true,
"resolve_outdated_diff_discussions": false, "resolve_outdated_diff_discussions": false,
"container_registry_enabled": false, "container_registry_enabled": false,
"created_at": "2013-09-30T13:46:02Z", "created_at": "2013-09-30T13:46:02Z",
...@@ -657,6 +662,7 @@ Example response: ...@@ -657,6 +662,7 @@ Example response:
"jobs_enabled": true, "jobs_enabled": true,
"wiki_enabled": true, "wiki_enabled": true,
"snippets_enabled": false, "snippets_enabled": false,
"can_create_merge_request_in": true,
"resolve_outdated_diff_discussions": false, "resolve_outdated_diff_discussions": false,
"container_registry_enabled": false, "container_registry_enabled": false,
"created_at": "2013-09-30T13:46:02Z", "created_at": "2013-09-30T13:46:02Z",
...@@ -774,6 +780,7 @@ GET /projects/:id ...@@ -774,6 +780,7 @@ GET /projects/:id
"jobs_enabled": true, "jobs_enabled": true,
"wiki_enabled": true, "wiki_enabled": true,
"snippets_enabled": false, "snippets_enabled": false,
"can_create_merge_request_in": true,
"resolve_outdated_diff_discussions": false, "resolve_outdated_diff_discussions": false,
"container_registry_enabled": false, "container_registry_enabled": false,
"container_expiration_policy": { "container_expiration_policy": {
...@@ -1260,6 +1267,7 @@ Example responses: ...@@ -1260,6 +1267,7 @@ Example responses:
"jobs_enabled": true, "jobs_enabled": true,
"wiki_enabled": true, "wiki_enabled": true,
"snippets_enabled": false, "snippets_enabled": false,
"can_create_merge_request_in": true,
"resolve_outdated_diff_discussions": false, "resolve_outdated_diff_discussions": false,
"container_registry_enabled": false, "container_registry_enabled": false,
"created_at": "2013-09-30T13:46:02Z", "created_at": "2013-09-30T13:46:02Z",
...@@ -1342,6 +1350,7 @@ Example response: ...@@ -1342,6 +1350,7 @@ Example response:
"jobs_enabled": true, "jobs_enabled": true,
"wiki_enabled": true, "wiki_enabled": true,
"snippets_enabled": false, "snippets_enabled": false,
"can_create_merge_request_in": true,
"resolve_outdated_diff_discussions": false, "resolve_outdated_diff_discussions": false,
"container_registry_enabled": false, "container_registry_enabled": false,
"created_at": "2013-09-30T13:46:02Z", "created_at": "2013-09-30T13:46:02Z",
...@@ -1431,6 +1440,7 @@ Example response: ...@@ -1431,6 +1440,7 @@ Example response:
"jobs_enabled": true, "jobs_enabled": true,
"wiki_enabled": true, "wiki_enabled": true,
"snippets_enabled": false, "snippets_enabled": false,
"can_create_merge_request_in": true,
"resolve_outdated_diff_discussions": false, "resolve_outdated_diff_discussions": false,
"container_registry_enabled": false, "container_registry_enabled": false,
"created_at": "2013-09-30T13:46:02Z", "created_at": "2013-09-30T13:46:02Z",
...@@ -1594,6 +1604,7 @@ Example response: ...@@ -1594,6 +1604,7 @@ Example response:
"jobs_enabled": true, "jobs_enabled": true,
"wiki_enabled": true, "wiki_enabled": true,
"snippets_enabled": false, "snippets_enabled": false,
"can_create_merge_request_in": true,
"resolve_outdated_diff_discussions": false, "resolve_outdated_diff_discussions": false,
"container_registry_enabled": false, "container_registry_enabled": false,
"created_at": "2013-09-30T13:46:02Z", "created_at": "2013-09-30T13:46:02Z",
...@@ -1702,6 +1713,7 @@ Example response: ...@@ -1702,6 +1713,7 @@ Example response:
"jobs_enabled": true, "jobs_enabled": true,
"wiki_enabled": true, "wiki_enabled": true,
"snippets_enabled": false, "snippets_enabled": false,
"can_create_merge_request_in": true,
"resolve_outdated_diff_discussions": false, "resolve_outdated_diff_discussions": false,
"container_registry_enabled": false, "container_registry_enabled": false,
"created_at": "2013-09-30T13:46:02Z", "created_at": "2013-09-30T13:46:02Z",
......
...@@ -132,6 +132,10 @@ module API ...@@ -132,6 +132,10 @@ module API
expose(:jobs_enabled) { |project, options| project.feature_available?(:builds, options[:current_user]) } expose(:jobs_enabled) { |project, options| project.feature_available?(:builds, options[:current_user]) }
expose(:snippets_enabled) { |project, options| project.feature_available?(:snippets, options[:current_user]) } expose(:snippets_enabled) { |project, options| project.feature_available?(:snippets, options[:current_user]) }
expose(:can_create_merge_request_in) do |project, options|
Ability.allowed?(options[:current_user], :create_merge_request_in, project)
end
expose(:issues_access_level) { |project, options| project.project_feature.string_access_level(:issues) } expose(:issues_access_level) { |project, options| project.project_feature.string_access_level(:issues) }
expose(:repository_access_level) { |project, options| project.project_feature.string_access_level(:repository) } expose(:repository_access_level) { |project, options| project.project_feature.string_access_level(:repository) }
expose(:merge_requests_access_level) { |project, options| project.project_feature.string_access_level(:merge_requests) } expose(:merge_requests_access_level) { |project, options| project.project_feature.string_access_level(:merge_requests) }
......
...@@ -1340,6 +1340,7 @@ describe API::Projects do ...@@ -1340,6 +1340,7 @@ describe API::Projects do
expect(json_response['path']).to be_present expect(json_response['path']).to be_present
expect(json_response['issues_enabled']).to be_present expect(json_response['issues_enabled']).to be_present
expect(json_response['merge_requests_enabled']).to be_present expect(json_response['merge_requests_enabled']).to be_present
expect(json_response['can_create_merge_request_in']).to be_present
expect(json_response['wiki_enabled']).to be_present expect(json_response['wiki_enabled']).to be_present
expect(json_response['jobs_enabled']).to be_present expect(json_response['jobs_enabled']).to be_present
expect(json_response['snippets_enabled']).to be_present expect(json_response['snippets_enabled']).to be_present
...@@ -1390,6 +1391,7 @@ describe API::Projects do ...@@ -1390,6 +1391,7 @@ describe API::Projects do
expect(json_response['path']).to be_present expect(json_response['path']).to be_present
expect(json_response['issues_enabled']).to be_present expect(json_response['issues_enabled']).to be_present
expect(json_response['merge_requests_enabled']).to be_present expect(json_response['merge_requests_enabled']).to be_present
expect(json_response['can_create_merge_request_in']).to be_present
expect(json_response['wiki_enabled']).to be_present expect(json_response['wiki_enabled']).to be_present
expect(json_response['jobs_enabled']).to be_present expect(json_response['jobs_enabled']).to be_present
expect(json_response['snippets_enabled']).to be_present expect(json_response['snippets_enabled']).to be_present
......
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