summaryrefslogtreecommitdiff
path: root/app/controllers/admin/projects_controller.rb
diff options
context:
space:
mode:
authorLuke Picciau <git@itscode.red>2019-05-29 20:18:40 +0000
committerRobert Speicher <rspeicher@gmail.com>2019-05-29 20:18:40 +0000
commitffe6cb57a64021dc593037ec18464fd728168ad1 (patch)
tree6e0d84f6548bb7bb81fe9884c9c6a465b808ede6 /app/controllers/admin/projects_controller.rb
parent76471e2f2752da661b7501b7b478316c1003b02b (diff)
downloadgitlab-ce-ffe6cb57a64021dc593037ec18464fd728168ad1.tar.gz
Redirect to admin projects index if project was deleted from admin page
Diffstat (limited to 'app/controllers/admin/projects_controller.rb')
-rw-r--r--app/controllers/admin/projects_controller.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb
index aeff0c96b64..70db15916b9 100644
--- a/app/controllers/admin/projects_controller.rb
+++ b/app/controllers/admin/projects_controller.rb
@@ -3,7 +3,7 @@
class Admin::ProjectsController < Admin::ApplicationController
include MembersPresentation
- before_action :project, only: [:show, :transfer, :repository_check]
+ before_action :project, only: [:show, :transfer, :repository_check, :destroy]
before_action :group, only: [:show, :transfer]
def index
@@ -35,6 +35,15 @@ class Admin::ProjectsController < Admin::ApplicationController
end
# rubocop: enable CodeReuse/ActiveRecord
+ def destroy
+ ::Projects::DestroyService.new(@project, current_user, {}).async_execute
+ flash[:notice] = _("Project '%{project_name}' is in the process of being deleted.") % { project_name: @project.full_name }
+
+ redirect_to admin_projects_path, status: :found
+ rescue Projects::DestroyService::DestroyError => ex
+ redirect_to admin_projects_path, status: 302, alert: ex.message
+ end
+
# rubocop: disable CodeReuse/ActiveRecord
def transfer
namespace = Namespace.find_by(id: params[:new_namespace_id])