Class: Labels::UpdateService
- Inherits:
-
BaseService
- Object
- BaseService
- BaseService
- Labels::UpdateService
- Defined in:
- app/services/labels/update_service.rb
Instance Attribute Summary
Attributes inherited from BaseService
#current_user, #params, #project
Instance Method Summary collapse
-
#execute(label) ⇒ Object
returns the updated label.
-
#initialize(params = {}) ⇒ UpdateService
constructor
A new instance of UpdateService.
Methods inherited from BaseService
Methods included from BaseServiceUtility
#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level
Methods included from Gitlab::Allowable
Constructor Details
#initialize(params = {}) ⇒ UpdateService
Returns a new instance of UpdateService.
5 6 7 |
# File 'app/services/labels/update_service.rb', line 5 def initialize(params = {}) @params = params.to_h.dup.with_indifferent_access end |
Instance Method Details
#execute(label) ⇒ Object
returns the updated label
10 11 12 13 14 15 16 17 |
# File 'app/services/labels/update_service.rb', line 10 def execute(label) params[:name] = params.delete(:new_name) if params.key?(:new_name) params[:color] = convert_color_name_to_hex if params[:color].present? params.delete(:lock_on_merge) unless allow_lock_on_merge?(label) label.update(params) label end |