Class: Namespaces::MarkForDeletionBaseService

Inherits:
BaseService
  • Object
show all
Defined in:
app/services/namespaces/mark_for_deletion_base_service.rb

Constant Summary collapse

DELETION_SCHEDULED_PATH_INFIX =
'deletion_scheduled'
LEGACY_DELETION_SCHEDULED_PATH_INFIX =
'deleted'

Constants inherited from BaseService

BaseService::UnauthorizedError

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #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?, #can_all?, #can_any?

Constructor Details

#initialize(resource, user, params = {}) ⇒ MarkForDeletionBaseService

Returns a new instance of MarkForDeletionBaseService.



8
9
10
11
12
# File 'app/services/namespaces/mark_for_deletion_base_service.rb', line 8

def initialize(resource, user, params = {})
  @resource = resource
  @current_user = user
  @params = params.dup
end

Instance Method Details

#executeObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/services/namespaces/mark_for_deletion_base_service.rb', line 14

def execute
  result = preconditions_checks
  return result if result.error?

  result = execute_deletion

  if result.success?
    log_event
    send_notification
    post_success
  else
    log_error(result.message)
  end

  result
end