Class: Issuable::BulkUpdateService
- Inherits:
-
Object
- Object
- Issuable::BulkUpdateService
- Includes:
- Gitlab::Allowable
- Defined in:
- app/services/issuable/bulk_update_service.rb
Instance Attribute Summary collapse
-
#current_user ⇒ Object
Returns the value of attribute current_user.
-
#params ⇒ Object
Returns the value of attribute params.
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
- #execute(type) ⇒ Object
-
#initialize(parent, user = nil, params = {}) ⇒ BulkUpdateService
constructor
A new instance of BulkUpdateService.
Methods included from Gitlab::Allowable
Constructor Details
#initialize(parent, user = nil, params = {}) ⇒ BulkUpdateService
Returns a new instance of BulkUpdateService.
9 10 11 12 13 |
# File 'app/services/issuable/bulk_update_service.rb', line 9 def initialize(parent, user = nil, params = {}) @parent = parent @current_user = user @params = params.dup end |
Instance Attribute Details
#current_user ⇒ Object
Returns the value of attribute current_user.
7 8 9 |
# File 'app/services/issuable/bulk_update_service.rb', line 7 def current_user @current_user end |
#params ⇒ Object
Returns the value of attribute params.
7 8 9 |
# File 'app/services/issuable/bulk_update_service.rb', line 7 def params @params end |
#parent ⇒ Object
Returns the value of attribute parent.
7 8 9 |
# File 'app/services/issuable/bulk_update_service.rb', line 7 def parent @parent end |
Instance Method Details
#execute(type) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/services/issuable/bulk_update_service.rb', line 15 def execute(type) model_ids = ids_from_params(params.delete(:issuable_ids)) set_update_params(type) updated_issuables = update_issuables(type, model_ids) if updated_issuables.present? && requires_count_cache_reset?(type) schedule_group_issues_count_reset(updated_issuables) end response_success(payload: { count: updated_issuables.size }) rescue ArgumentError => e response_error(e., 422) end |