diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 13:16:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 13:16:36 +0000 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /app/services/members/create_service.rb | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) | |
download | gitlab-ce-311b0269b4eb9839fa63f80c8d7a58f32b8138a0.tar.gz |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'app/services/members/create_service.rb')
-rw-r--r-- | app/services/members/create_service.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/app/services/members/create_service.rb b/app/services/members/create_service.rb index 0cc62e661a3..cb905e01613 100644 --- a/app/services/members/create_service.rb +++ b/app/services/members/create_service.rb @@ -63,10 +63,14 @@ module Members invites, params[:access_level], expires_at: params[:expires_at], - current_user: current_user + current_user: current_user, + tasks_to_be_done: params[:tasks_to_be_done], + tasks_project_id: params[:tasks_project_id] ) members.each { |member| process_result(member) } + + create_tasks_to_be_done end def process_result(member) @@ -112,6 +116,19 @@ module Members end end + def create_tasks_to_be_done + return unless experiment(:invite_members_for_task).enabled? + return if params[:tasks_to_be_done].blank? || params[:tasks_project_id].blank? + + valid_members = members.select { |member| member.valid? && member.member_task.valid? } + return unless valid_members.present? + + # We can take the first `member_task` here, since all tasks will have the same attributes needed + # for the `TasksToBeDone::CreateWorker`, ie. `project` and `tasks_to_be_done`. + member_task = valid_members[0].member_task + TasksToBeDone::CreateWorker.perform_async(member_task.id, current_user.id, valid_members.map(&:user_id)) + end + def areas_of_focus params[:areas_of_focus] || [] end |