Merge branch '5594-geo-add-repository-verification-failures-to-api' into 'master'
Backport of gitlab-org/gitlab-ee!6137 See merge request gitlab-org/gitlab-ce!20699
This commit is contained in:
commit
b60364c0f3
2 changed files with 23 additions and 3 deletions
|
@ -55,6 +55,8 @@ GET /projects
|
|||
| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) |
|
||||
| `with_issues_enabled` | boolean | no | Limit by enabled issues feature |
|
||||
| `with_merge_requests_enabled` | boolean | no | Limit by enabled merge requests feature |
|
||||
| `wiki_checksum_failed` | boolean | no | Limit projects where the wiki checksum calculation has failed _([Introduced][ee-6137] in [GitLab Premium][eep] 11.2)_ |
|
||||
| `repository_checksum_failed` | boolean | no | Limit projects where the repository checksum calculation has failed _([Introduced][ee-6137] in [GitLab Premium][eep] 11.2)_ |
|
||||
|
||||
When `simple=true` or the user is unauthenticated this returns something like:
|
||||
|
||||
|
@ -1509,3 +1511,6 @@ GET /projects/:id/snapshot
|
|||
| --------- | ---- | -------- | ----------- |
|
||||
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
|
||||
| `wiki` | boolean | no | Whether to download the wiki, rather than project, repository |
|
||||
|
||||
[eep]: https://about.gitlab.com/pricing/ "Available only in GitLab Premium"
|
||||
[ee-6137]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/6137
|
||||
|
|
|
@ -8,6 +8,21 @@ module API
|
|||
|
||||
before { authenticate_non_get! }
|
||||
|
||||
helpers do
|
||||
params :optional_filter_params_ee do
|
||||
# EE::API::Projects would override this helper
|
||||
end
|
||||
|
||||
# EE::API::Projects would override this method
|
||||
def apply_filters(projects)
|
||||
projects = projects.with_issues_available_for_user(current_user) if params[:with_issues_enabled]
|
||||
projects = projects.with_merge_requests_enabled if params[:with_merge_requests_enabled]
|
||||
projects = projects.with_statistics if params[:statistics]
|
||||
|
||||
projects
|
||||
end
|
||||
end
|
||||
|
||||
helpers do
|
||||
params :statistics_params do
|
||||
optional :statistics, type: Boolean, default: false, desc: 'Include project statistics'
|
||||
|
@ -39,6 +54,8 @@ module API
|
|||
optional :membership, type: Boolean, default: false, desc: 'Limit by projects that the current user is a member of'
|
||||
optional :with_issues_enabled, type: Boolean, default: false, desc: 'Limit by enabled issues feature'
|
||||
optional :with_merge_requests_enabled, type: Boolean, default: false, desc: 'Limit by enabled merge requests feature'
|
||||
|
||||
use :optional_filter_params_ee
|
||||
end
|
||||
|
||||
params :create_params do
|
||||
|
@ -52,9 +69,7 @@ module API
|
|||
|
||||
def present_projects(projects, options = {})
|
||||
projects = reorder_projects(projects)
|
||||
projects = projects.with_issues_available_for_user(current_user) if params[:with_issues_enabled]
|
||||
projects = projects.with_merge_requests_enabled if params[:with_merge_requests_enabled]
|
||||
projects = projects.with_statistics if params[:statistics]
|
||||
projects = apply_filters(projects)
|
||||
projects = paginate(projects)
|
||||
projects, options = with_custom_attributes(projects, options)
|
||||
|
||||
|
|
Loading…
Reference in a new issue