Class: Admin::AbuseReportLabels::CreateService

Inherits:
Labels::BaseService show all
Defined in:
app/services/admin/abuse_report_labels/create_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods inherited from Labels::BaseService

#convert_color_name_to_hex

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

#can?

Constructor Details

#initialize(params = {}) ⇒ CreateService

Returns a new instance of CreateService.



6
7
8
# File 'app/services/admin/abuse_report_labels/create_service.rb', line 6

def initialize(params = {})
  @params = params
end

Instance Method Details

#executeObject



10
11
12
13
14
# File 'app/services/admin/abuse_report_labels/create_service.rb', line 10

def execute
  params[:color] = convert_color_name_to_hex if params[:color].present?

  ::Admin::AbuseReportLabel.create(params)
end