2021-03-05 15:09:12 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mutations
|
|
|
|
module UserCallouts
|
|
|
|
class Create < ::Mutations::BaseMutation
|
|
|
|
graphql_name 'UserCalloutCreate'
|
|
|
|
|
|
|
|
argument :feature_name,
|
2021-07-22 21:09:40 +00:00
|
|
|
GraphQL::Types::String,
|
2021-03-05 15:09:12 +00:00
|
|
|
required: true,
|
2021-08-18 00:11:18 +00:00
|
|
|
description: "Feature name you want to dismiss the callout for."
|
2021-03-05 15:09:12 +00:00
|
|
|
|
|
|
|
field :user_callout, Types::UserCalloutType,
|
|
|
|
null: false,
|
2021-08-18 00:11:18 +00:00
|
|
|
description: 'User callout dismissed.'
|
2021-03-05 15:09:12 +00:00
|
|
|
|
|
|
|
def resolve(feature_name:)
|
|
|
|
callout = Users::DismissUserCalloutService.new(
|
|
|
|
container: nil, current_user: current_user, params: { feature_name: feature_name }
|
|
|
|
).execute
|
|
|
|
errors = errors_on_object(callout)
|
|
|
|
|
|
|
|
{
|
|
|
|
user_callout: callout,
|
|
|
|
errors: errors
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|