Skip to content
代码片段 群组 项目
未验证 提交 61cfd1d2 编辑于 作者: Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
浏览文件

Wrap group removal into service

上级 79aac2c1
No related branches found
No related tags found
无相关合并请求
......@@ -47,7 +47,7 @@ def members_update
end
def destroy
@group.destroy
DestroyGroupService.new(@group, current_user).execute
redirect_to admin_groups_path, notice: 'Group was successfully deleted.'
end
......
......@@ -82,7 +82,7 @@ def update
end
def destroy
@group.destroy
DestroyGroupService.new(@group, current_user).execute
redirect_to root_path, notice: 'Group was removed.'
end
......
class DestroyGroupService
attr_accessor :group, :current_user
def initialize(group, user)
@group, @current_user = group, user
end
def execute
@group.destroy
end
end
......@@ -62,7 +62,7 @@ class Groups < Grape::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
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册