Welcome to mirror list, hosted at ThFree Co, Russian Federation.

remove.rb « award_emojis « mutations « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c654688c6dc82dbc4d0e606046633f393b2ac2ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

module Mutations
  module AwardEmojis
    class Remove < Base
      graphql_name 'AwardEmojiRemove'

      def resolve(args)
        awardable = authorized_find!(id: args[:awardable_id])

        check_object_is_awardable!(awardable)

        service = ::AwardEmojis::DestroyService.new(awardable, args[:name], current_user).execute

        {
          # Mutation response is always a `nil` award_emoji
          errors: service[:errors] || []
        }
      end
    end
  end
end