diff options
author | Camil Staps <info@camilstaps.nl> | 2019-02-08 16:09:54 +0300 |
---|---|---|
committer | Camil Staps <info@camilstaps.nl> | 2019-08-07 21:49:17 +0300 |
commit | 73e6ba448db379216f5b703b11295f3751fee16a (patch) | |
tree | 6af1cc6552d85b4a888872b3161630d733f0481b | |
parent | 1289efcc62c027b39dcabc211e60830ae71be75f (diff) |
Address reviewer comments
-rw-r--r-- | app/finders/starred_projects_finder.rb | 1 | ||||
-rw-r--r-- | doc/api/projects.md | 40 | ||||
-rw-r--r-- | locale/gitlab.pot | 15 | ||||
-rw-r--r-- | spec/requests/api/projects_spec.rb | 2 |
4 files changed, 40 insertions, 18 deletions
diff --git a/app/finders/starred_projects_finder.rb b/app/finders/starred_projects_finder.rb index 0a67a1242ff..e38cb8c4569 100644 --- a/app/finders/starred_projects_finder.rb +++ b/app/finders/starred_projects_finder.rb @@ -3,6 +3,7 @@ class StarredProjectsFinder < ProjectsFinder def initialize(user, params: {}, current_user: nil) project_ids = user.starred_projects.select(:id) + super(params: params, current_user: current_user, project_ids_relation: project_ids) end end diff --git a/doc/api/projects.md b/doc/api/projects.md index 1ce9912027c..8f68557edb3 100644 --- a/doc/api/projects.md +++ b/doc/api/projects.md @@ -475,21 +475,27 @@ GET /users/:user_id/starred_projects | Attribute | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `user_id` | string | yes | The ID or username of the user | -| `archived` | boolean | no | Limit by archived status | -| `visibility` | string | no | Limit by visibility `public`, `internal`, or `private` | -| `order_by` | string | no | Return projects ordered by `id`, `name`, `path`, `created_at`, `updated_at`, or `last_activity_at` fields. Default is `created_at` | -| `sort` | string | no | Return projects sorted in `asc` or `desc` order. Default is `desc` | -| `search` | string | no | Return list of projects matching the search criteria | -| `simple` | boolean | no | Return only limited fields for each project. This is a no-op without authentication as then _only_ simple fields are returned. | -| `owned` | boolean | no | Limit by projects explicitly owned by the current user | -| `membership` | boolean | no | Limit by projects that the current user is a member of | -| `starred` | boolean | no | Limit by projects starred by the current user | -| `statistics` | boolean | no | Include project statistics | -| `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 | -| `min_access_level` | integer | no | Limit by current user minimal [access level](members.md) | +| `user_id` | string | yes | The ID or username of the user. | +| `archived` | boolean | no | Limit by archived status. | +| `visibility` | string | no | Limit by visibility `public`, `internal`, or `private`. | +| `order_by` | string | no | Return projects ordered by `id`, `name`, `path`, `created_at`, `updated_at`, or `last_activity_at` fields. Default is `created_at`. | +| `sort` | string | no | Return projects sorted in `asc` or `desc` order. Default is `desc`. | +| `search` | string | no | Return list of projects matching the search criteria. | +| `simple` | boolean | no | Return only limited fields for each project. This is a no-op without authentication as then _only_ simple fields are returned.. | +| `owned` | boolean | no | Limit by projects explicitly owned by the current user. | +| `membership` | boolean | no | Limit by projects that the current user is a member of. | +| `starred` | boolean | no | Limit by projects starred by the current user. | +| `statistics` | boolean | no | Include project statistics. | +| `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. | +| `min_access_level` | integer | no | Limit by current user minimal [access level](members.md). | + +```bash +curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/users/5/starred_projects" +``` + +Example response: ```json [ @@ -1339,7 +1345,7 @@ Example response: ## List Starrers of a project -List the users who starred the the specified project +List the users who starred the specified project. ``` GET /projects/:id/starrers @@ -1347,7 +1353,7 @@ GET /projects/:id/starrers | Attribute | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `search` | string | no | Search for specific users | +| `search` | string | no | Search for specific users. | ```bash curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/starrers" diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 367de1c6843..d1bc37a7042 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -8543,6 +8543,12 @@ msgstr "" msgid "ProjectOverview|Star" msgstr "" +msgid "ProjectOverview|Starrer" +msgstr "" + +msgid "ProjectOverview|Starrers" +msgstr "" + msgid "ProjectOverview|Unstar" msgstr "" @@ -10286,6 +10292,9 @@ msgstr "" msgid "SortOptions|Recent sign in" msgstr "" +msgid "SortOptions|Recently starred" +msgstr "" + msgid "SortOptions|Sort direction" msgstr "" @@ -10379,6 +10388,9 @@ msgstr "" msgid "StarredProjectsEmptyState|You don't have starred projects yet." msgstr "" +msgid "Starrers" +msgstr "" + msgid "Stars" msgstr "" @@ -12221,6 +12233,9 @@ msgstr "" msgid "UserProfile|Snippets in GitLab can either be private, internal, or public." msgstr "" +msgid "UserProfile|Starred projects" +msgstr "" + msgid "UserProfile|Subscribe" msgstr "" diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index b3e1ff4e647..1d7ca85cdd2 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -844,7 +844,7 @@ describe API::Projects do end it 'returns error when user not found' do - get api('/users/9999/projects/') + get api('/users/9999/starred_projects/') expect(response).to have_gitlab_http_status(404) expect(json_response['message']).to eq('404 User Not Found') |