diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-23 15:11:40 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-23 15:11:40 +0300 |
commit | f94cd1d0fb5c0b42ec12a8db02ec90227bb98879 (patch) | |
tree | 4169149a04009ea4038d22fccb83d210d45c035a /app/services/members | |
parent | cd3d3a7d5c5f15d14e1ea0beb71a4af8200003a5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/members')
-rw-r--r-- | app/services/members/create_service.rb | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/app/services/members/create_service.rb b/app/services/members/create_service.rb index 9cedc7ee3a5..20460d2c312 100644 --- a/app/services/members/create_service.rb +++ b/app/services/members/create_service.rb @@ -82,16 +82,33 @@ module Members end def add_members - @members = source.add_members( - invites, - params[:access_level], - expires_at: params[:expires_at], - current_user: current_user - ) + @members = if Feature.enabled?(:invitations_member_role_id, source) + creator_service.add_members( + source, invites, params[:access_level], **create_params + ) + else + source.add_members( + invites, + params[:access_level], + expires_at: params[:expires_at], + current_user: current_user + ) + end members.each { |member| process_result(member) } end + def creator_service + "Members::#{source.class.to_s.pluralize}::CreatorService".constantize + end + + def create_params + { + expires_at: params[:expires_at], + current_user: current_user + } + end + def process_result(member) existing_errors = member.errors.full_messages |