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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
41518a46
Commit
41518a46
authored
Oct 22, 2014
by
Vinnie Okada
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove :keep_repo option
Always delete repositories from the filesystem when deleting a project.
parent
68b5ac7f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
27 deletions
+7
-27
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+1
-2
app/services/projects/destroy_service.rb
app/services/projects/destroy_service.rb
+5
-8
lib/api/projects.rb
lib/api/projects.rb
+1
-7
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+0
-10
No files found.
app/controllers/projects_controller.rb
View file @
41518a46
...
@@ -100,8 +100,7 @@ class ProjectsController < ApplicationController
...
@@ -100,8 +100,7 @@ class ProjectsController < ApplicationController
def
destroy
def
destroy
return
access_denied!
unless
can?
(
current_user
,
:remove_project
,
project
)
return
access_denied!
unless
can?
(
current_user
,
:remove_project
,
project
)
::
Projects
::
DestroyService
.
new
(
@project
,
current_user
,
::
Projects
::
DestroyService
.
new
(
@project
,
current_user
,
{}).
execute
keep_repo:
params
[
:keep_repo
]).
execute
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
do
format
.
html
do
...
...
app/services/projects/destroy_service.rb
View file @
41518a46
...
@@ -6,10 +6,7 @@ module Projects
...
@@ -6,10 +6,7 @@ module Projects
project
.
team
.
truncate
project
.
team
.
truncate
project
.
repository
.
expire_cache
unless
project
.
empty_repo?
project
.
repository
.
expire_cache
unless
project
.
empty_repo?
result
=
project
.
destroy
if
project
.
destroy
return
false
unless
result
unless
params
[
:keep_repo
]
GitlabShellWorker
.
perform_async
(
GitlabShellWorker
.
perform_async
(
:remove_repository
,
:remove_repository
,
project
.
path_with_namespace
project
.
path_with_namespace
...
@@ -21,11 +18,11 @@ module Projects
...
@@ -21,11 +18,11 @@ module Projects
)
)
project
.
satellite
.
destroy
project
.
satellite
.
destroy
end
log_info
(
"Project
\"
#{
project
.
name
}
\"
was removed"
)
log_info
(
"Project
\"
#{
project
.
name
}
\"
was removed"
)
system_hook_service
.
execute_hooks_for
(
project
,
:destroy
)
system_hook_service
.
execute_hooks_for
(
project
,
:destroy
)
result
true
end
end
end
end
end
end
end
lib/api/projects.rb
View file @
41518a46
...
@@ -174,17 +174,11 @@ module API
...
@@ -174,17 +174,11 @@ module API
#
#
# Parameters:
# Parameters:
# id (required) - The ID of a project
# id (required) - The ID of a project
# keep_repo (optional) - If true, then delete the project from the
# database but keep the repo, wiki, and satellite on disk.
# Example Request:
# Example Request:
# DELETE /projects/:id
# DELETE /projects/:id
delete
":id"
do
delete
":id"
do
authorize!
:remove_project
,
user_project
authorize!
:remove_project
,
user_project
::
Projects
::
DestroyService
.
new
(
::
Projects
::
DestroyService
.
new
(
user_project
,
current_user
,
{}).
execute
user_project
,
current_user
,
keep_repo:
params
[
:keep_repo
]
).
execute
end
end
# Mark this project as forked from another
# Mark this project as forked from another
...
...
spec/requests/api/projects_spec.rb
View file @
41518a46
...
@@ -641,16 +641,6 @@ describe API::API, api: true do
...
@@ -641,16 +641,6 @@ describe API::API, api: true do
response
.
status
.
should
==
200
response
.
status
.
should
==
200
end
end
it
'should keep repo when "keep_repo" param is true'
do
expect
(
GitlabShellWorker
).
not_to
(
receive
(
:perform_async
).
with
(
:remove_repository
,
/
#{
project
.
path_with_namespace
}
/
)
)
delete
api
(
"/projects/
#{
project
.
id
}
?keep_repo=true"
,
user
)
response
.
status
.
should
==
200
end
it
"should not remove a project if not an owner"
do
it
"should not remove a project if not an owner"
do
user3
=
create
(
:user
)
user3
=
create
(
:user
)
project
.
team
<<
[
user3
,
:developer
]
project
.
team
<<
[
user3
,
:developer
]
...
...
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