Skip to content
Snippets Groups Projects
Verified Commit 61cfd1d2 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Wrap group removal into service

parent 79aac2c1
No related branches found
No related tags found
1 merge request!9354Fix group remove [For test purposes]
Loading
Loading
@@ -47,7 +47,7 @@ class Admin::GroupsController < Admin::ApplicationController
end
 
def destroy
@group.destroy
DestroyGroupService.new(@group, current_user).execute
 
redirect_to admin_groups_path, notice: 'Group was successfully deleted.'
end
Loading
Loading
Loading
Loading
@@ -82,7 +82,7 @@ class GroupsController < Groups::ApplicationController
end
 
def destroy
@group.destroy
DestroyGroupService.new(@group, current_user).execute
 
redirect_to root_path, notice: 'Group was removed.'
end
Loading
Loading
class DestroyGroupService
attr_accessor :group, :current_user
def initialize(group, user)
@group, @current_user = group, user
end
def execute
@group.destroy
end
end
Loading
Loading
@@ -62,7 +62,7 @@ module API
delete ":id" do
group = find_group(params[:id])
authorize! :admin_group, group
group.destroy
DestroyGroupService.new(group, current_user).execute
end
 
# Transfer a project to the Group namespace
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment