Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
eff55685
Commit
eff55685
authored
Sep 07, 2021
by
Eulyeon Ko
Committed by
charlie ablett
Sep 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Allow filtering of issues by reaction emoji in GraphQL"
parent
11f7bc17
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
71 additions
and
10 deletions
+71
-10
app/graphql/resolvers/concerns/issue_resolver_arguments.rb
app/graphql/resolvers/concerns/issue_resolver_arguments.rb
+4
-1
app/graphql/types/boards/board_issuable_input_base_type.rb
app/graphql/types/boards/board_issuable_input_base_type.rb
+1
-1
app/graphql/types/issues/negated_issue_filter_input_type.rb
app/graphql/types/issues/negated_issue_filter_input_type.rb
+3
-0
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+13
-8
spec/graphql/resolvers/issues_resolver_spec.rb
spec/graphql/resolvers/issues_resolver_spec.rb
+22
-0
spec/requests/api/graphql/project/issues_spec.rb
spec/requests/api/graphql/project/issues_spec.rb
+28
-0
No files found.
app/graphql/resolvers/concerns/issue_resolver_arguments.rb
View file @
eff55685
...
...
@@ -30,7 +30,7 @@ module IssueResolverArguments
description:
'Usernames of users assigned to the issue.'
argument
:assignee_id
,
GraphQL
::
Types
::
String
,
required:
false
,
description:
'ID of a user assigned to the issues
, "none" and "any" values
are supported.'
description:
'ID of a user assigned to the issues
. Wildcard values "NONE" and "ANY"
are supported.'
argument
:created_before
,
Types
::
TimeType
,
required:
false
,
description:
'Issues created before this date.'
...
...
@@ -59,6 +59,9 @@ module IssueResolverArguments
argument
:milestone_wildcard_id
,
::
Types
::
MilestoneWildcardIdEnum
,
required:
false
,
description:
'Filter issues by milestone ID wildcard.'
argument
:my_reaction_emoji
,
GraphQL
::
Types
::
String
,
required:
false
,
description:
'Filter by reaction emoji applied by the current user. Wildcard values "NONE" and "ANY" are supported.'
argument
:not
,
Types
::
Issues
::
NegatedIssueFilterInputType
,
description:
'Negated arguments.'
,
prepare:
->
(
negated_args
,
ctx
)
{
negated_args
.
to_h
},
...
...
app/graphql/types/boards/board_issuable_input_base_type.rb
View file @
eff55685
...
...
@@ -14,7 +14,7 @@ module Types
argument
:my_reaction_emoji
,
GraphQL
::
Types
::
String
,
required:
false
,
description:
'Filter by reaction emoji applied by the current user.'
description:
'Filter by reaction emoji applied by the current user.
Wildcard values "NONE" and "ANY" are supported.
'
end
end
end
app/graphql/types/issues/negated_issue_filter_input_type.rb
View file @
eff55685
...
...
@@ -23,6 +23,9 @@ module Types
argument
:milestone_wildcard_id
,
::
Types
::
NegatedMilestoneWildcardIdEnum
,
required:
false
,
description:
'Filter by negated milestone wildcard values.'
argument
:my_reaction_emoji
,
GraphQL
::
Types
::
String
,
required:
false
,
description:
'Filter by reaction emoji applied by the current user.'
end
end
end
...
...
doc/api/graphql/reference/index.md
View file @
eff55685
This diff is collapsed.
Click to expand it.
spec/graphql/resolvers/issues_resolver_spec.rb
View file @
eff55685
...
...
@@ -19,6 +19,7 @@ RSpec.describe Resolvers::IssuesResolver do
let_it_be
(
:issue4
)
{
create
(
:issue
)
}
let_it_be
(
:label1
)
{
create
(
:label
,
project:
project
)
}
let_it_be
(
:label2
)
{
create
(
:label
,
project:
project
)
}
let_it_be
(
:upvote_award
)
{
create
(
:award_emoji
,
:upvote
,
user:
current_user
,
awardable:
issue1
)
}
specify
do
expect
(
described_class
).
to
have_nullable_graphql_type
(
Types
::
IssueType
.
connection_type
)
...
...
@@ -198,6 +199,27 @@ RSpec.describe Resolvers::IssuesResolver do
end
end
context
'filtering by reaction emoji'
do
let_it_be
(
:downvoted_issue
)
{
create
(
:issue
,
project:
project
)
}
let_it_be
(
:downvote_award
)
{
create
(
:award_emoji
,
:downvote
,
user:
current_user
,
awardable:
downvoted_issue
)
}
it
'filters by reaction emoji'
do
expect
(
resolve_issues
(
my_reaction_emoji:
upvote_award
.
name
)).
to
contain_exactly
(
issue1
)
end
it
'filters by reaction emoji wildcard "none"'
do
expect
(
resolve_issues
(
my_reaction_emoji:
'none'
)).
to
contain_exactly
(
issue2
)
end
it
'filters by reaction emoji wildcard "any"'
do
expect
(
resolve_issues
(
my_reaction_emoji:
'any'
)).
to
contain_exactly
(
issue1
,
downvoted_issue
)
end
it
'filters by negated reaction emoji'
do
expect
(
resolve_issues
(
not:
{
my_reaction_emoji:
downvote_award
.
name
})).
to
contain_exactly
(
issue1
,
issue2
)
end
end
context
'when searching issues'
do
it
'returns correct issues'
do
expect
(
resolve_issues
(
search:
'foo'
)).
to
contain_exactly
(
issue2
)
...
...
spec/requests/api/graphql/project/issues_spec.rb
View file @
eff55685
...
...
@@ -61,6 +61,34 @@ RSpec.describe 'getting an issue list for a project' do
end
end
context
'filtering by my_reaction_emoji'
do
using
RSpec
::
Parameterized
::
TableSyntax
let_it_be
(
:upvote_award
)
{
create
(
:award_emoji
,
:upvote
,
user:
current_user
,
awardable:
issue_a
)
}
let
(
:issue_a_gid
)
{
issue_a
.
to_global_id
.
to_s
}
let
(
:issue_b_gid
)
{
issue_b
.
to_global_id
.
to_s
}
where
(
:value
,
:gids
)
do
'thumbsup'
|
lazy
{
[
issue_a_gid
]
}
'ANY'
|
lazy
{
[
issue_a_gid
]
}
'any'
|
lazy
{
[
issue_a_gid
]
}
'AnY'
|
lazy
{
[
issue_a_gid
]
}
'NONE'
|
lazy
{
[
issue_b_gid
]
}
'thumbsdown'
|
lazy
{
[]
}
end
with_them
do
let
(
:issue_filter_params
)
{
{
my_reaction_emoji:
value
}
}
it
'returns correctly filtered issues'
do
post_graphql
(
query
,
current_user:
current_user
)
expect
(
graphql_dig_at
(
issues_data
,
:node
,
:id
)).
to
eq
(
gids
)
end
end
end
context
'when limiting the number of results'
do
let
(
:query
)
do
<<~
GQL
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment