Class: Pages::DeleteService
- Inherits:
-
BaseService
- Object
- BaseService
- Pages::DeleteService
- Defined in:
- app/services/pages/delete_service.rb
Constant Summary
Constants inherited from BaseService
BaseService::UnauthorizedError
Instance Attribute Summary
Attributes inherited from BaseService
#current_user, #params, #project
Instance Method Summary collapse
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
This class inherits a constructor from BaseService
Instance Method Details
#execute ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/services/pages/delete_service.rb', line 5 def execute if current_user.is_a?(User) && !can_remove_pages? return ServiceResponse.error(message: _('The current user is not authorized to remove the Pages deployment'), reason: :forbidden) end PagesDeployment.deactivate_all(project) # 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 DestroyPagesDeploymentsWorker.perform_async(project.id) end |