Class: Mutations::WorkItems::SavedViews::Update

Inherits:
BaseMutation
  • Object
show all
Includes:
SpamProtection
Defined in:
app/graphql/mutations/work_items/saved_views/update.rb

Constant Summary

Constants included from SpamProtection

SpamProtection::NEEDS_CAPTCHA_RESPONSE_MESSAGE, SpamProtection::NeedsCaptchaResponseError, SpamProtection::SPAM_DISALLOWED_MESSAGE, SpamProtection::SpamActionError, SpamProtection::SpamDisallowedError

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 Spam::Concerns::HasSpamActionResponseFields

#spam_action_response_fields

Methods inherited from BaseMutation

#api_user?, authorization, authorization_scopes, authorized?, authorizes_object?, #current_user, #errors_on_object, #load_application_object, #read_only?, #ready?, #unauthorized_object

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

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

Instance Method Details

#resolve(id:, **attrs) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'app/graphql/mutations/work_items/saved_views/update.rb', line 64

def resolve(id:, **attrs)
  saved_view = authorized_find!(id: id)

  result = ::WorkItems::SavedViews::UpdateService.new(
    current_user: current_user,
    saved_view: saved_view,
    params: attrs
  ).execute

  if result.success?
    check_spam_action_response!(saved_view)
    { saved_view: saved_view, errors: [] }
  else
    { saved_view: nil, errors: result.message }
  end
end