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
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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
4 deletions
+26
-4
project.rb
app/models/project.rb
+3
-0
namespaceless_project_destroy_worker.rb
app/workers/namespaceless_project_destroy_worker.rb
+0
-4
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
# 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
...
...
app/workers/namespaceless_project_destroy_worker.rb
View file @
0de85b53
...
...
@@ -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
...
...
spec/models/project_spec.rb
View file @
0de85b53
...
...
@@ -2311,6 +2311,29 @@ describe Project do
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
it
'returns the number of forks'
do
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