debian-mirror-gitlab/app/graphql/mutations/saved_replies/update.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
1 KiB
Ruby
Raw Normal View History

2022-05-07 20:08:51 +05:30
# frozen_string_literal: true
module Mutations
module SavedReplies
class Update < Base
graphql_name 'SavedReplyUpdate'
authorize :update_saved_replies
argument :id, Types::GlobalIDType[::Users::SavedReply],
required: true,
description: copy_field_description(Types::SavedReplyType, :id)
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(id:, name:, content:)
raise Gitlab::Graphql::Errors::ResourceNotAvailable, 'Feature disabled' unless feature_enabled?
saved_reply = authorized_find!(id)
2022-06-21 17:19:12 +05:30
result = ::Users::SavedReplies::UpdateService.new(saved_reply: saved_reply, name: name, content: content).execute
2022-05-07 20:08:51 +05:30
present_result(result)
end
end
end
end