Add my_reaction_emoji param to /issues API
This commit is contained in:
parent
597bc29260
commit
cf9c54bd31
|
@ -14,6 +14,7 @@
|
|||
# search: string
|
||||
# label_name: string
|
||||
# sort: string
|
||||
# my_reaction_emoji: string
|
||||
#
|
||||
class IssuesFinder < IssuableFinder
|
||||
CONFIDENTIAL_ACCESS_LEVEL = Gitlab::Access::REPORTER
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Add my_reaction_emoji param to /issues API
|
||||
merge_request: 14016
|
||||
author: Hiroyuki Sato
|
||||
type: added
|
|
@ -30,16 +30,18 @@ GET /issues?milestone=1.0.0&state=opened
|
|||
GET /issues?iids[]=42&iids[]=43
|
||||
GET /issues?author_id=5
|
||||
GET /issues?assignee_id=5
|
||||
GET /issues?my_reaction_emoji=star
|
||||
```
|
||||
|
||||
| Attribute | Type | Required | Description |
|
||||
|-------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------------------|
|
||||
| ------------------- | ---------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `state` | string | no | Return all issues or just those that are `opened` or `closed` |
|
||||
| `labels` | string | no | Comma-separated list of label names, issues must have all labels to be returned. `No+Label` lists all issues with no labels |
|
||||
| `milestone` | string | no | The milestone title |
|
||||
| `scope` | string | no | Return issues for the given scope: `created-by-me`, `assigned-to-me` or `all`. Defaults to `created-by-me` _([Introduced][ce-13004] in GitLab 9.5)_ |
|
||||
| `author_id` | integer | no | Return issues created by the given user `id`. Combine with `scope=all` or `scope=assigned-to-me`. _([Introduced][ce-13004] in GitLab 9.5)_ |
|
||||
| `assignee_id` | integer | no | Return issues assigned to the given user `id` _([Introduced][ce-13004] in GitLab 9.5)_ |
|
||||
| `my_reaction_emoji` | string | no | Return issues reacted by the authenticated user by the given emoji ` _([Introduced][ce-14016] in GitLab 10.0)_ |
|
||||
| `iids[]` | Array[integer] | no | Return only the issues having the given `iid` |
|
||||
| `order_by` | string | no | Return issues ordered by `created_at` or `updated_at` fields. Default is `created_at` |
|
||||
| `sort` | string | no | Return issues sorted in `asc` or `desc` order. Default is `desc` |
|
||||
|
@ -131,10 +133,11 @@ GET /groups/:id/issues?iids[]=42&iids[]=43
|
|||
GET /groups/:id/issues?search=issue+title+or+description
|
||||
GET /groups/:id/issues?author_id=5
|
||||
GET /groups/:id/issues?assignee_id=5
|
||||
GET /groups/:id/issues?my_reaction_emoji=star
|
||||
```
|
||||
|
||||
| Attribute | Type | Required | Description |
|
||||
|-------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------------------|
|
||||
| ------------------- | ---------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user |
|
||||
| `state` | string | no | Return all issues or just those that are `opened` or `closed` |
|
||||
| `labels` | string | no | Comma-separated list of label names, issues must have all labels to be returned. `No+Label` lists all issues with no labels |
|
||||
|
@ -143,6 +146,7 @@ GET /groups/:id/issues?assignee_id=5
|
|||
| `scope` | string | no | Return issues for the given scope: `created-by-me`, `assigned-to-me` or `all` _([Introduced][ce-13004] in GitLab 9.5)_ |
|
||||
| `author_id` | integer | no | Return issues created by the given user `id` _([Introduced][ce-13004] in GitLab 9.5)_ |
|
||||
| `assignee_id` | integer | no | Return issues assigned to the given user `id` _([Introduced][ce-13004] in GitLab 9.5)_ |
|
||||
| `my_reaction_emoji` | string | no | Return issues reacted by the authenticated user by the given emoji ` _([Introduced][ce-14016] in GitLab 10.0)_ |
|
||||
| `order_by` | string | no | Return issues ordered by `created_at` or `updated_at` fields. Default is `created_at` |
|
||||
| `sort` | string | no | Return issues sorted in `asc` or `desc` order. Default is `desc` |
|
||||
| `search` | string | no | Search group issues against their `title` and `description` |
|
||||
|
@ -234,10 +238,11 @@ GET /projects/:id/issues?iids[]=42&iids[]=43
|
|||
GET /projects/:id/issues?search=issue+title+or+description
|
||||
GET /projects/:id/issues?author_id=5
|
||||
GET /projects/:id/issues?assignee_id=5
|
||||
GET /projects/:id/issues?my_reaction_emoji=star
|
||||
```
|
||||
|
||||
| Attribute | Type | Required | Description |
|
||||
|-------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------------------|
|
||||
| ------------------- | ---------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
|
||||
| `iids[]` | Array[integer] | no | Return only the milestone having the given `iid` |
|
||||
| `state` | string | no | Return all issues or just those that are `opened` or `closed` |
|
||||
|
@ -246,6 +251,7 @@ GET /projects/:id/issues?assignee_id=5
|
|||
| `scope` | string | no | Return issues for the given scope: `created-by-me`, `assigned-to-me` or `all` _([Introduced][ce-13004] in GitLab 9.5)_ |
|
||||
| `author_id` | integer | no | Return issues created by the given user `id` _([Introduced][ce-13004] in GitLab 9.5)_ |
|
||||
| `assignee_id` | integer | no | Return issues assigned to the given user `id` _([Introduced][ce-13004] in GitLab 9.5)_ |
|
||||
| `my_reaction_emoji` | string | no | Return issues reacted by the authenticated user by the given emoji ` _([Introduced][ce-14016] in GitLab 10.0)_ |
|
||||
| `order_by` | string | no | Return issues ordered by `created_at` or `updated_at` fields. Default is `created_at` |
|
||||
| `sort` | string | no | Return issues sorted in `asc` or `desc` order. Default is `desc` |
|
||||
| `search` | string | no | Search project issues against their `title` and `description` |
|
||||
|
|
|
@ -36,6 +36,7 @@ module API
|
|||
optional :assignee_id, type: Integer, desc: 'Return issues which are assigned to the user with the given ID'
|
||||
optional :scope, type: String, values: %w[created-by-me assigned-to-me all],
|
||||
desc: 'Return issues for the given scope: `created-by-me`, `assigned-to-me` or `all`'
|
||||
optional :my_reaction_emoji, type: String, desc: 'Return issues reacted by the authenticated user by the given emoji'
|
||||
use :pagination
|
||||
end
|
||||
|
||||
|
|
|
@ -138,6 +138,16 @@ describe API::Issues, :mailer do
|
|||
expect(first_issue['id']).to eq(issue2.id)
|
||||
end
|
||||
|
||||
it 'returns issues reacted by the authenticated user by the given emoji' do
|
||||
issue2 = create(:issue, project: project, author: user, assignees: [user])
|
||||
award_emoji = create(:award_emoji, awardable: issue2, user: user2, name: 'star')
|
||||
|
||||
get api('/issues', user2), my_reaction_emoji: award_emoji.name, scope: 'all'
|
||||
|
||||
expect_paginated_array_response(size: 1)
|
||||
expect(first_issue['id']).to eq(issue2.id)
|
||||
end
|
||||
|
||||
it 'returns issues matching given search string for title' do
|
||||
get api("/issues", user), search: issue.title
|
||||
|
||||
|
|
Loading…
Reference in New Issue