2021-03-05 10:09:12 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mutations
|
|
|
|
module UserCallouts
|
|
|
|
class Create < ::Mutations::BaseMutation
|
|
|
|
graphql_name 'UserCalloutCreate'
|
|
|
|
|
|
|
|
argument :feature_name,
|
2021-07-22 17:09:40 -04:00
|
|
|
GraphQL::Types::String,
|
2021-03-05 10:09:12 -05:00
|
|
|
required: true,
|
2021-08-17 20:11:18 -04:00
|
|
|
description: "Feature name you want to dismiss the callout for."
|
2021-03-05 10:09:12 -05:00
|
|
|
|
|
|
|
field :user_callout, Types::UserCalloutType,
|
|
|
|
null: false,
|
2021-08-17 20:11:18 -04:00
|
|
|
description: 'User callout dismissed.'
|
2021-03-05 10:09:12 -05:00
|
|
|
|
|
|
|
def resolve(feature_name:)
|
2022-07-14 05:09:25 -04:00
|
|
|
callout = ::Users::DismissCalloutService.new(
|
2021-03-05 10:09:12 -05:00
|
|
|
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
|