Commit de59f0a1 authored by Shinya Maeda's avatar Shinya Maeda

Merge branch '218624-roadmaps-conf-filter' into 'master'

Add confidentiality filtering to api endpoints

See merge request gitlab-org/gitlab!51105
parents d835e80e 936fc7d5
---
title: Add confidentiality filtering to the epics REST API and GraphQL endpoints
merge_request: 51105
author:
type: added
...@@ -1459,6 +1459,11 @@ type BoardEpic implements CurrentUserTodos & Noteable { ...@@ -1459,6 +1459,11 @@ type BoardEpic implements CurrentUserTodos & Noteable {
""" """
before: String before: String
"""
Filter epics by given confidentiality
"""
confidential: Boolean
""" """
List items overlapping a time frame defined by startDate..endDate (if one List items overlapping a time frame defined by startDate..endDate (if one
date is provided, both must be present) Deprecated in 13.5: Use timeframe.end. date is provided, both must be present) Deprecated in 13.5: Use timeframe.end.
...@@ -8013,6 +8018,11 @@ type Epic implements CurrentUserTodos & Noteable { ...@@ -8013,6 +8018,11 @@ type Epic implements CurrentUserTodos & Noteable {
""" """
before: String before: String
"""
Filter epics by given confidentiality
"""
confidential: Boolean
""" """
List items overlapping a time frame defined by startDate..endDate (if one List items overlapping a time frame defined by startDate..endDate (if one
date is provided, both must be present) Deprecated in 13.5: Use timeframe.end. date is provided, both must be present) Deprecated in 13.5: Use timeframe.end.
...@@ -9932,6 +9942,11 @@ type Group { ...@@ -9932,6 +9942,11 @@ type Group {
""" """
authorUsername: String authorUsername: String
"""
Filter epics by given confidentiality
"""
confidential: Boolean
""" """
List items overlapping a time frame defined by startDate..endDate (if one List items overlapping a time frame defined by startDate..endDate (if one
date is provided, both must be present) Deprecated in 13.5: Use timeframe.end. date is provided, both must be present) Deprecated in 13.5: Use timeframe.end.
...@@ -10050,6 +10065,11 @@ type Group { ...@@ -10050,6 +10065,11 @@ type Group {
""" """
before: String before: String
"""
Filter epics by given confidentiality
"""
confidential: Boolean
""" """
List items overlapping a time frame defined by startDate..endDate (if one List items overlapping a time frame defined by startDate..endDate (if one
date is provided, both must be present) Deprecated in 13.5: Use timeframe.end. date is provided, both must be present) Deprecated in 13.5: Use timeframe.end.
......
...@@ -3980,6 +3980,16 @@ ...@@ -3980,6 +3980,16 @@
}, },
"defaultValue": "true" "defaultValue": "true"
}, },
{
"name": "confidential",
"description": "Filter epics by given confidentiality",
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"defaultValue": null
},
{ {
"name": "after", "name": "after",
"description": "Returns the elements in the list that come after the specified cursor.", "description": "Returns the elements in the list that come after the specified cursor.",
...@@ -22397,6 +22407,16 @@ ...@@ -22397,6 +22407,16 @@
}, },
"defaultValue": "true" "defaultValue": "true"
}, },
{
"name": "confidential",
"description": "Filter epics by given confidentiality",
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"defaultValue": null
},
{ {
"name": "after", "name": "after",
"description": "Returns the elements in the list that come after the specified cursor.", "description": "Returns the elements in the list that come after the specified cursor.",
...@@ -27604,6 +27624,16 @@ ...@@ -27604,6 +27624,16 @@
"ofType": null "ofType": null
}, },
"defaultValue": "true" "defaultValue": "true"
},
{
"name": "confidential",
"description": "Filter epics by given confidentiality",
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"defaultValue": null
} }
], ],
"type": { "type": {
...@@ -27844,6 +27874,16 @@ ...@@ -27844,6 +27874,16 @@
}, },
"defaultValue": "true" "defaultValue": "true"
}, },
{
"name": "confidential",
"description": "Filter epics by given confidentiality",
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"defaultValue": null
},
{ {
"name": "after", "name": "after",
"description": "Returns the elements in the list that come after the specified cursor.", "description": "Returns the elements in the list that come after the specified cursor.",
...@@ -46,6 +46,10 @@ module Resolvers ...@@ -46,6 +46,10 @@ module Resolvers
description: 'Include epics from descendant groups', description: 'Include epics from descendant groups',
default_value: true default_value: true
argument :confidential, GraphQL::BOOLEAN_TYPE,
required: false,
description: 'Filter epics by given confidentiality'
type Types::EpicType, null: true type Types::EpicType, null: true
def ready?(**args) def ready?(**args)
......
...@@ -39,6 +39,7 @@ module API ...@@ -39,6 +39,7 @@ module API
optional :include_ancestor_groups, type: Boolean, default: false, desc: 'Include epics from ancestor groups' optional :include_ancestor_groups, type: Boolean, default: false, desc: 'Include epics from ancestor groups'
optional :include_descendant_groups, type: Boolean, default: true, desc: 'Include epics from descendant groups' optional :include_descendant_groups, type: Boolean, default: true, desc: 'Include epics from descendant groups'
optional :my_reaction_emoji, type: String, desc: 'Return epics reacted by the authenticated user by the given emoji' optional :my_reaction_emoji, type: String, desc: 'Return epics reacted by the authenticated user by the given emoji'
optional :confidential, type: Boolean, desc: 'Return epics with given confidentiality'
use :pagination use :pagination
end end
[':id/epics', ':id/-/epics'].each do |path| [':id/epics', ':id/-/epics'].each do |path|
......
...@@ -221,6 +221,16 @@ RSpec.describe API::Epics do ...@@ -221,6 +221,16 @@ RSpec.describe API::Epics do
expect_paginated_array_response([epic2.id, epic.id]) expect_paginated_array_response([epic2.id, epic.id])
end end
it 'returns epics matching given confidentiality' do
group.add_developer(user)
epic3 = create(:epic, group: group, confidential: true)
get api(url, user), params: { confidential: true }
expect_paginated_array_response([epic3.id])
end
it 'has upvote/downvote information' do it 'has upvote/downvote information' do
create(:award_emoji, name: 'thumbsup', awardable: epic, user: user ) create(:award_emoji, name: 'thumbsup', awardable: epic, user: user )
create(:award_emoji, name: 'thumbsdown', awardable: epic2, user: user ) create(:award_emoji, name: 'thumbsdown', awardable: epic2, user: user )
......
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