Skip to content
Snippets Groups Projects
Unverified Commit 890ffac6 authored by Yorick Peterse's avatar Yorick Peterse
Browse files

Use a method for creating groups in the API

EE has some custom behaviour that needs to run before and after creating
a group in the API. By moving the group creation logic to a separate
method, EE can easily extend this behaviour; without having to directly
modify the API source code.
parent 654c4dd9
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -58,6 +58,14 @@ module API
end
# rubocop: enable CodeReuse/ActiveRecord
 
def create_group
# This is a separate method so that EE can extend its behaviour, without
# having to modify this code directly.
::Groups::CreateService
.new(current_user, declared_params(include_missing: false))
.execute
end
def find_group_projects(params)
group = find_group!(params[:id])
options = {
Loading
Loading
@@ -127,7 +135,7 @@ module API
authorize! :create_group
end
 
group = ::Groups::CreateService.new(current_user, declared_params(include_missing: false)).execute
group = create_group
 
if group.persisted?
present group, with: Entities::GroupDetail, current_user: current_user
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