Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
c9856e53
Commit
c9856e53
authored
Aug 17, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run remove_pages in a run_after_commit block
parent
0de85b53
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
1 deletion
+21
-1
app/models/project.rb
app/models/project.rb
+1
-1
changelogs/unreleased/35072-fix-pages-delete.yml
changelogs/unreleased/35072-fix-pages-delete.yml
+5
-0
spec/models/project_spec.rb
spec/models/project_spec.rb
+15
-0
No files found.
app/models/project.rb
View file @
c9856e53
...
@@ -60,7 +60,7 @@ class Project < ActiveRecord::Base
...
@@ -60,7 +60,7 @@ class Project < ActiveRecord::Base
end
end
before_destroy
:remove_private_deploy_keys
before_destroy
:remove_private_deploy_keys
after_destroy
:remove_pages
after_destroy
->
{
run_after_commit
{
remove_pages
}
}
# update visibility_level of forks
# update visibility_level of forks
after_update
:update_forks_visibility_level
after_update
:update_forks_visibility_level
...
...
changelogs/unreleased/35072-fix-pages-delete.yml
0 → 100644
View file @
c9856e53
---
title
:
Fix deleting GitLab Pages files when a project is removed
merge_request
:
13631
author
:
type
:
fixed
spec/models/project_spec.rb
View file @
c9856e53
...
@@ -2313,6 +2313,7 @@ describe Project do
...
@@ -2313,6 +2313,7 @@ describe Project do
describe
'#remove_pages'
do
describe
'#remove_pages'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:namespace
)
{
project
.
namespace
}
let
(
:pages_path
)
{
project
.
pages_path
}
let
(
:pages_path
)
{
project
.
pages_path
}
around
do
|
example
|
around
do
|
example
|
...
@@ -2324,6 +2325,14 @@ describe Project do
...
@@ -2324,6 +2325,14 @@ describe Project do
end
end
end
end
it
'removes the pages directory'
do
expect_any_instance_of
(
Projects
::
UpdatePagesConfigurationService
).
to
receive
(
:execute
)
expect_any_instance_of
(
Gitlab
::
PagesTransfer
).
to
receive
(
:rename_project
).
and_return
(
true
)
expect
(
PagesWorker
).
to
receive
(
:perform_in
).
with
(
5
.
minutes
,
:remove
,
namespace
.
full_path
,
anything
)
project
.
remove_pages
end
it
'is a no-op when there is no namespace'
do
it
'is a no-op when there is no namespace'
do
project
.
update_column
(
:namespace_id
,
nil
)
project
.
update_column
(
:namespace_id
,
nil
)
...
@@ -2332,6 +2341,12 @@ describe Project do
...
@@ -2332,6 +2341,12 @@ describe Project do
project
.
remove_pages
project
.
remove_pages
end
end
it
'is run when the project is destroyed'
do
expect
(
project
).
to
receive
(
:remove_pages
).
and_call_original
project
.
destroy
end
end
end
describe
'#forks_count'
do
describe
'#forks_count'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment