Class: Pages::DeleteService

Inherits:
BaseService show all
Defined in:
app/services/pages/delete_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

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

This class inherits a constructor from BaseService

Instance Method Details

#executeObject


5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/services/pages/delete_service.rb', line 5

def execute
  project.mark_pages_as_not_deployed

  # project.pages_domains.delete_all will just nullify project_id:
  # > If no :dependent option is given, then it will follow the default
  # > strategy for `has_many :through` associations.
  # > The default strategy is :nullify which sets the foreign keys to NULL.
  PagesDomain.for_project(project).delete_all

  publish_deleted_event

  DestroyPagesDeploymentsWorker.perform_async(project.id)
end