Class: Mutations::CustomEmoji::Create

Inherits:
BaseMutation
  • Object
show all
Includes:
ResolvesGroup
Defined in:
app/graphql/mutations/custom_emoji/create.rb

Constant Summary

Constants inherited from BaseMutation

BaseMutation::ERROR_MESSAGE

Constants included from Gitlab::Graphql::Authorize::AuthorizeResource

Gitlab::Graphql::Authorize::AuthorizeResource::ConfigurationError, Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR

Instance Method Summary collapse

Methods included from ResolvesGroup

#group_resolver, #resolve_group

Methods inherited from BaseMutation

#api_user?, authorization, authorized?, authorizes_object?, #current_user, #errors_on_object, #load_application_object, #ready?

Methods included from Gitlab::Graphql::Authorize::AuthorizeResource

#authorize!, #authorized_find!, #authorized_resource?, #raise_resource_not_available_error!

Methods included from Gitlab::Graphql::GlobalIDCompatibility

#coerce_global_id_arguments!

Instance Method Details

#resolve(group_path:, **args) ⇒ Object


30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/graphql/mutations/custom_emoji/create.rb', line 30

def resolve(group_path:, **args)
  group = authorized_find!(group_path: group_path)
  # See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/37911#note_444682238
  args[:external] = true
  args[:creator] = current_user

  custom_emoji = group.custom_emoji.create(args)

  {
    custom_emoji: custom_emoji.valid? ? custom_emoji : nil,
    errors: errors_on_object(custom_emoji)
  }
end