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
695def36
Commit
695def36
authored
Feb 24, 2021
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add UserCallout GraphQL type
Creates the UserCallout GraphQL type
parent
0a2e826a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
0 deletions
+48
-0
app/graphql/types/user_callout_feature_name_enum.rb
app/graphql/types/user_callout_feature_name_enum.rb
+12
-0
app/graphql/types/user_callout_type.rb
app/graphql/types/user_callout_type.rb
+14
-0
spec/graphql/types/user_callout_feature_name_enum_spec.rb
spec/graphql/types/user_callout_feature_name_enum_spec.rb
+11
-0
spec/graphql/types/user_callout_type_spec.rb
spec/graphql/types/user_callout_type_spec.rb
+11
-0
No files found.
app/graphql/types/user_callout_feature_name_enum.rb
0 → 100644
View file @
695def36
# frozen_string_literal: true
module
Types
class
UserCalloutFeatureNameEnum
<
BaseEnum
graphql_name
'UserCalloutFeatureNameEnum'
description
'Name of the feature that the callout is for'
::
UserCallout
.
feature_names
.
keys
.
each
do
|
feature_name
|
value
feature_name
.
upcase
,
value:
feature_name
end
end
end
app/graphql/types/user_callout_type.rb
0 → 100644
View file @
695def36
# frozen_string_literal: true
module
Types
# rubocop:disable Graphql/AuthorizeTypes
class
UserCalloutType
<
BaseObject
graphql_name
'UserCallout'
field
:feature_name
,
UserCalloutFeatureNameEnum
,
null:
false
,
description:
'Name of the feature that the callout is for.'
field
:dismissed_at
,
Types
::
TimeType
,
null:
true
,
description:
'Date when the callout was dismissed.'
end
# rubocop:enable Graphql/AuthorizeTypes
end
spec/graphql/types/user_callout_feature_name_enum_spec.rb
0 → 100644
View file @
695def36
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
GitlabSchema
.
types
[
'UserCalloutFeatureNameEnum'
]
do
specify
{
expect
(
described_class
.
graphql_name
).
to
eq
(
'UserCalloutFeatureNameEnum'
)
}
it
'exposes all the existing user callout feature names'
do
expect
(
described_class
.
values
.
keys
).
to
match_array
(
::
UserCallout
.
feature_names
.
keys
.
map
(
&
:upcase
))
end
end
spec/graphql/types/user_callout_type_spec.rb
0 → 100644
View file @
695def36
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
GitlabSchema
.
types
[
'UserCallout'
]
do
specify
{
expect
(
described_class
.
graphql_name
).
to
eq
(
'UserCallout'
)
}
it
'has expected fields'
do
expect
(
described_class
).
to
have_graphql_fields
(
:feature_name
,
:dismissed_at
)
end
end
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