diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-08-17 11:44:35 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-08-17 11:44:35 +0000 |
commit | fe0ffcc78941bf9de98e3698e743c3cbb9846b6a (patch) | |
tree | b5d5e12a6c3ccacacaa3507abd307c7dc068efd2 /app | |
parent | 7e13bb9af391fe0f6cf87a44e5908a640a832313 (diff) | |
parent | c9856e53ea05374dcab0a591bd0352d321120b68 (diff) | |
download | gitlab-ce-fe0ffcc78941bf9de98e3698e743c3cbb9846b6a.tar.gz |
Merge branch '35072-fix-pages-delete' into 'master'
Resolve "Deleting of a GitLab Pages project results in "`PagesWorker.perform_in` cannot be called inside a transaction""
Closes #35072
See merge request !13631
Diffstat (limited to 'app')
-rw-r--r-- | app/models/project.rb | 5 | ||||
-rw-r--r-- | app/workers/namespaceless_project_destroy_worker.rb | 4 |
2 files changed, 4 insertions, 5 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 22b347cc8f9..89b4debcd42 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -60,7 +60,7 @@ class Project < ActiveRecord::Base end before_destroy :remove_private_deploy_keys - after_destroy :remove_pages + after_destroy -> { run_after_commit { remove_pages } } # update visibility_level of forks after_update :update_forks_visibility_level @@ -1224,6 +1224,9 @@ class Project < ActiveRecord::Base # TODO: what to do here when not using Legacy Storage? Do we still need to rename and delay removal? def remove_pages + # Projects with a missing namespace cannot have their pages removed + return unless namespace + ::Projects::UpdatePagesConfigurationService.new(self).execute # 1. We rename pages to temporary directory diff --git a/app/workers/namespaceless_project_destroy_worker.rb b/app/workers/namespaceless_project_destroy_worker.rb index bfae0c77700..a9073742ff7 100644 --- a/app/workers/namespaceless_project_destroy_worker.rb +++ b/app/workers/namespaceless_project_destroy_worker.rb @@ -24,10 +24,6 @@ class NamespacelessProjectDestroyWorker unlink_fork(project) if project.forked? - # Override Project#remove_pages for this instance so it doesn't do anything - def project.remove_pages - end - project.destroy! end |