debian-mirror-gitlab/app/graphql/mutations/user_callouts/create.rb

31 lines
806 B
Ruby
Raw Normal View History

2021-04-17 20:07:23 +05:30
# frozen_string_literal: true
module Mutations
module UserCallouts
class Create < ::Mutations::BaseMutation
graphql_name 'UserCalloutCreate'
argument :feature_name,
2021-10-27 15:23:28 +05:30
GraphQL::Types::String,
2021-04-17 20:07:23 +05:30
required: true,
2021-10-27 15:23:28 +05:30
description: "Feature name you want to dismiss the callout for."
2021-04-17 20:07:23 +05:30
field :user_callout, Types::UserCalloutType,
null: false,
2021-10-27 15:23:28 +05:30
description: 'User callout dismissed.'
2021-04-17 20:07:23 +05:30
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