Class: Admin::AbuseReports::UpdateService

Inherits:
BaseService
  • Object
show all
Defined in:
app/services/admin/abuse_reports/update_service.rb

Instance Attribute Summary collapse

Attributes inherited from BaseService

#project

Instance Method Summary collapse

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(abuse_report, current_user, params) ⇒ UpdateService

Returns a new instance of UpdateService.



8
9
10
11
12
# File 'app/services/admin/abuse_reports/update_service.rb', line 8

def initialize(abuse_report, current_user, params)
  @abuse_report = abuse_report
  @current_user = current_user
  @params = params
end

Instance Attribute Details

#abuse_reportObject (readonly)

Returns the value of attribute abuse_report.



6
7
8
# File 'app/services/admin/abuse_reports/update_service.rb', line 6

def abuse_report
  @abuse_report
end

#current_userObject (readonly)

Returns the value of attribute current_user.



6
7
8
# File 'app/services/admin/abuse_reports/update_service.rb', line 6

def current_user
  @current_user
end

#paramsObject (readonly)

Returns the value of attribute params.



6
7
8
# File 'app/services/admin/abuse_reports/update_service.rb', line 6

def params
  @params
end

Instance Method Details

#executeObject



14
15
16
17
18
19
20
# File 'app/services/admin/abuse_reports/update_service.rb', line 14

def execute
  return ServiceResponse.error(message: 'Admin is required') unless current_user&.can_admin_all_resources?

  abuse_report.label_ids = label_ids

  ServiceResponse.success
end