Class: Mutations::WorkItems::Update
- Inherits:
-
BaseMutation
- Object
- GraphQL::Schema::RelayClassicMutation
- BaseMutation
- Mutations::WorkItems::Update
- Includes:
- SpamProtection, SharedArguments, Widgetable
- Defined in:
- app/graphql/mutations/work_items/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
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 Widgetable
Methods included from Spam::Concerns::HasSpamActionResponseFields
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?, #find_object, #raise_resource_not_available_error!
Instance Method Details
#resolve(id:, **attributes) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'app/graphql/mutations/work_items/update.rb', line 68 def resolve(id:, **attributes) Gitlab::QueryLimiting.disable!('https://gitlab.com/gitlab-org/gitlab/-/issues/408575') work_item = (id: id) = (work_item.work_item_type, attributes, work_item.resource_parent) # Only checks permissions for base attributes because widgets define their own permissions independently raise_resource_not_available_error! unless attributes.empty? || can_update?(work_item) update_result = ::WorkItems::UpdateService.new( container: work_item.resource_parent, current_user: current_user, params: attributes, widget_params: , perform_spam_check: true ).execute(work_item) check_spam_action_response!(work_item) { work_item: (update_result[:work_item] if update_result[:status] == :success), errors: Array.wrap(update_result[:message]) } end |