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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
0de85b53
Commit
0de85b53
authored
Aug 17, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove a wat in NamespacelessProjectDestroyWorker
parent
db3289be
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
4 deletions
+26
-4
app/models/project.rb
app/models/project.rb
+3
-0
app/workers/namespaceless_project_destroy_worker.rb
app/workers/namespaceless_project_destroy_worker.rb
+0
-4
spec/models/project_spec.rb
spec/models/project_spec.rb
+23
-0
No files found.
app/models/project.rb
View file @
0de85b53
...
@@ -1224,6 +1224,9 @@ class Project < ActiveRecord::Base
...
@@ -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?
# TODO: what to do here when not using Legacy Storage? Do we still need to rename and delay removal?
def
remove_pages
def
remove_pages
# Projects with a missing namespace cannot have their pages removed
return
unless
namespace
::
Projects
::
UpdatePagesConfigurationService
.
new
(
self
).
execute
::
Projects
::
UpdatePagesConfigurationService
.
new
(
self
).
execute
# 1. We rename pages to temporary directory
# 1. We rename pages to temporary directory
...
...
app/workers/namespaceless_project_destroy_worker.rb
View file @
0de85b53
...
@@ -24,10 +24,6 @@ class NamespacelessProjectDestroyWorker
...
@@ -24,10 +24,6 @@ class NamespacelessProjectDestroyWorker
unlink_fork
(
project
)
if
project
.
forked?
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!
project
.
destroy!
end
end
...
...
spec/models/project_spec.rb
View file @
0de85b53
...
@@ -2311,6 +2311,29 @@ describe Project do
...
@@ -2311,6 +2311,29 @@ describe Project do
end
end
end
end
describe
'#remove_pages'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:pages_path
)
{
project
.
pages_path
}
around
do
|
example
|
FileUtils
.
mkdir_p
(
pages_path
)
begin
example
.
run
ensure
FileUtils
.
rm_rf
(
pages_path
)
end
end
it
'is a no-op when there is no namespace'
do
project
.
update_column
(
:namespace_id
,
nil
)
expect_any_instance_of
(
Projects
::
UpdatePagesConfigurationService
).
not_to
receive
(
:execute
)
expect_any_instance_of
(
Gitlab
::
PagesTransfer
).
not_to
receive
(
:rename_project
)
project
.
remove_pages
end
end
describe
'#forks_count'
do
describe
'#forks_count'
do
it
'returns the number of forks'
do
it
'returns the number of forks'
do
project
=
build
(
:project
)
project
=
build
(
:project
)
...
...
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