BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
1 deletion
+21
-1
project.rb
app/models/project.rb
+1
-1
35072-fix-pages-delete.yml
changelogs/unreleased/35072-fix-pages-delete.yml
+5
-0
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
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
...
...
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
describe
'#remove_pages'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:namespace
)
{
project
.
namespace
}
let
(
:pages_path
)
{
project
.
pages_path
}
around
do
|
example
|
...
...
@@ -2324,6 +2325,14 @@ describe Project do
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
project
.
update_column
(
:namespace_id
,
nil
)
...
...
@@ -2332,6 +2341,12 @@ describe Project do
project
.
remove_pages
end
it
'is run when the project is destroyed'
do
expect
(
project
).
to
receive
(
:remove_pages
).
and_call_original
project
.
destroy
end
end
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