diff options
Diffstat (limited to 'app/services/projects/destroy_service.rb')
-rw-r--r-- | app/services/projects/destroy_service.rb | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/app/services/projects/destroy_service.rb b/app/services/projects/destroy_service.rb index b7ed9202b01..aef92b8adee 100644 --- a/app/services/projects/destroy_service.rb +++ b/app/services/projects/destroy_service.rb @@ -28,9 +28,7 @@ module Projects # Git data (e.g. a list of branch names). flush_caches(project) - if Feature.enabled?(:abort_deleted_project_pipelines, default_enabled: :yaml) - ::Ci::AbortPipelinesService.new.execute(project.all_pipelines, :project_deleted) - end + ::Ci::AbortPipelinesService.new.execute(project.all_pipelines, :project_deleted) Projects::UnlinkForkService.new(project, current_user).execute @@ -75,6 +73,18 @@ module Projects response.success? end + def destroy_events! + unless remove_events + raise_error(s_('DeleteProject|Failed to remove events. Please try again or contact administrator.')) + end + end + + def remove_events + response = ::Events::DestroyService.new(project).execute + + response.success? + end + def remove_repository(repository) return true unless repository @@ -117,14 +127,10 @@ module Projects log_destroy_event trash_relation_repositories! trash_project_repositories! + destroy_events! destroy_web_hooks! destroy_project_bots! - - if ::Feature.enabled?(:ci_optimize_project_records_destruction, project, default_enabled: :yaml) && - Feature.enabled?(:abort_deleted_project_pipelines, default_enabled: :yaml) - - destroy_ci_records! - end + destroy_ci_records! # Rails attempts to load all related records into memory before # destroying: https://github.com/rails/rails/issues/22510 @@ -150,7 +156,7 @@ module Projects ::Ci::DestroyPipelineService.new(project, current_user).execute(pipeline) end - deleted_count = project.commit_statuses.delete_all + deleted_count = ::CommitStatus.for_project(project).delete_all Gitlab::AppLogger.info( class: 'Projects::DestroyService', |