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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
61cfd1d2
Commit
61cfd1d2
authored
Jun 03, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wrap group removal into service
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
79aac2c1
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
3 deletions
+14
-3
app/controllers/admin/groups_controller.rb
app/controllers/admin/groups_controller.rb
+1
-1
app/controllers/groups_controller.rb
app/controllers/groups_controller.rb
+1
-1
app/services/destroy_group_service.rb
app/services/destroy_group_service.rb
+11
-0
lib/api/groups.rb
lib/api/groups.rb
+1
-1
No files found.
app/controllers/admin/groups_controller.rb
View file @
61cfd1d2
...
@@ -47,7 +47,7 @@ class Admin::GroupsController < Admin::ApplicationController
...
@@ -47,7 +47,7 @@ class Admin::GroupsController < Admin::ApplicationController
end
end
def
destroy
def
destroy
@group
.
destroy
DestroyGroupService
.
new
(
@group
,
current_user
).
execute
redirect_to
admin_groups_path
,
notice:
'Group was successfully deleted.'
redirect_to
admin_groups_path
,
notice:
'Group was successfully deleted.'
end
end
...
...
app/controllers/groups_controller.rb
View file @
61cfd1d2
...
@@ -82,7 +82,7 @@ class GroupsController < Groups::ApplicationController
...
@@ -82,7 +82,7 @@ class GroupsController < Groups::ApplicationController
end
end
def
destroy
def
destroy
@group
.
destroy
DestroyGroupService
.
new
(
@group
,
current_user
).
execute
redirect_to
root_path
,
notice:
'Group was removed.'
redirect_to
root_path
,
notice:
'Group was removed.'
end
end
...
...
app/services/destroy_group_service.rb
0 → 100644
View file @
61cfd1d2
class
DestroyGroupService
attr_accessor
:group
,
:current_user
def
initialize
(
group
,
user
)
@group
,
@current_user
=
group
,
user
end
def
execute
@group
.
destroy
end
end
lib/api/groups.rb
View file @
61cfd1d2
...
@@ -62,7 +62,7 @@ module API
...
@@ -62,7 +62,7 @@ module API
delete
":id"
do
delete
":id"
do
group
=
find_group
(
params
[
:id
])
group
=
find_group
(
params
[
:id
])
authorize!
:admin_group
,
group
authorize!
:admin_group
,
group
group
.
destroy
DestroyGroupService
.
new
(
group
,
current_user
).
execute
end
end
# Transfer a project to the Group namespace
# Transfer a project to the Group namespace
...
...
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