debian-mirror-gitlab/app/graphql/mutations/saved_replies/create.rb
2022-05-07 20:08:51 +05:30

26 lines
819 B
Ruby

# frozen_string_literal: true
module Mutations
module SavedReplies
class Create < Base
graphql_name 'SavedReplyCreate'
authorize :create_saved_replies
argument :name, GraphQL::Types::String,
required: true,
description: copy_field_description(Types::SavedReplyType, :name)
argument :content, GraphQL::Types::String,
required: true,
description: copy_field_description(Types::SavedReplyType, :content)
def resolve(name:, content:)
raise Gitlab::Graphql::Errors::ResourceNotAvailable, 'Feature disabled' unless feature_enabled?
result = ::Users::SavedReplies::CreateService.new(current_user: current_user, name: name, content: content).execute
present_result(result)
end
end
end
end