Class: Mutations::Issues::BulkUpdate
- Inherits:
-
BaseMutation
- Object
- GraphQL::Schema::RelayClassicMutation
- BaseMutation
- Mutations::Issues::BulkUpdate
- Defined in:
- app/graphql/mutations/issues/bulk_update.rb
Constant Summary collapse
- MAX_ISSUES =
100
Constants included from Gitlab::Graphql::Authorize::AuthorizeResource
Gitlab::Graphql::Authorize::AuthorizeResource::ConfigurationError, Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR
Constants inherited from BaseMutation
Instance Method Summary collapse
Methods included from Gitlab::Graphql::Authorize::AuthorizeResource
#authorize!, #authorized_find!, #authorized_resource?, #find_object, #raise_resource_not_available_error!
Methods inherited from BaseMutation
#api_user?, authorization, authorized?, authorizes_object?, #current_user, #errors_on_object, #load_application_object, #read_only?, #unauthorized_object
Instance Method Details
#ready?(**args) ⇒ Boolean
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/graphql/mutations/issues/bulk_update.rb', line 55 def ready?(**args) if Feature.disabled?(:bulk_update_issues_mutation) raise Gitlab::Graphql::Errors::ResourceNotAvailable, '`bulk_update_issues_mutation` feature flag is disabled.' end if args[:ids].size > MAX_ISSUES raise Gitlab::Graphql::Errors::ArgumentError, format(_('No more than %{max_issues} issues can be updated at the same time'), max_issues: MAX_ISSUES) end super end |
#resolve(ids:, parent_id:, **attributes) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'app/graphql/mutations/issues/bulk_update.rb', line 68 def resolve(ids:, parent_id:, **attributes) parent = find_parent!(parent_id) result = Issuable::BulkUpdateService.new( parent, current_user, prepared_params(attributes, ids) ).execute('issue') if result.success? { updated_issue_count: result.payload[:count], errors: [] } else { errors: result.errors } end end |