Commit 936fc7d5 authored by Jarka Košanová's avatar Jarka Košanová

Add confidentiality filtering to epics api endpoints

- add the filter to the REST API endpoint
- add the filter to the graphql epics endpoint
parent a61bd329
---
title: Add confidentiality filtering to the epics REST API and GraphQL endpoints
merge_request: 51105
author:
type: added
...@@ -1449,6 +1449,11 @@ type BoardEpic implements CurrentUserTodos & Noteable { ...@@ -1449,6 +1449,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.
...@@ -8003,6 +8008,11 @@ type Epic implements CurrentUserTodos & Noteable { ...@@ -8003,6 +8008,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.
...@@ -9892,6 +9902,11 @@ type Group { ...@@ -9892,6 +9902,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.
...@@ -10010,6 +10025,11 @@ type Group { ...@@ -10010,6 +10025,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.
......
...@@ -3944,6 +3944,16 @@ ...@@ -3944,6 +3944,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.",
...@@ -22361,6 +22371,16 @@ ...@@ -22361,6 +22371,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.",
...@@ -27505,6 +27525,16 @@ ...@@ -27505,6 +27525,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": {
...@@ -27745,6 +27775,16 @@ ...@@ -27745,6 +27775,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