diff options
Diffstat (limited to 'app/helpers/invite_members_helper.rb')
-rw-r--r-- | app/helpers/invite_members_helper.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/helpers/invite_members_helper.rb b/app/helpers/invite_members_helper.rb index d9bd64f4c2e..01ae0ce4f31 100644 --- a/app/helpers/invite_members_helper.rb +++ b/app/helpers/invite_members_helper.rb @@ -42,6 +42,14 @@ module InviteMembersHelper e.candidate { dataset.merge!(areas_of_focus_options: member_areas_of_focus_options.to_json, no_selection_areas_of_focus: ['no_selection']) } end + if show_invite_members_for_task? + dataset.merge!( + tasks_to_be_done_options: tasks_to_be_done_options.to_json, + projects: projects_for_source(source).to_json, + new_project_path: source.is_a?(Group) ? new_project_path(namespace_id: source.id) : '' + ) + end + dataset end @@ -71,4 +79,19 @@ module InviteMembersHelper def users_filter_data(group) {} end + + def show_invite_members_for_task? + return unless current_user && experiment(:invite_members_for_task).enabled? + + params[:open_modal] == 'invite_members_for_task' + end + + def tasks_to_be_done_options + ::MemberTask::TASKS.keys.map { |task| { value: task, text: localized_tasks_to_be_done_choices[task] } } + end + + def projects_for_source(source) + projects = source.is_a?(Project) ? [source] : source.projects + projects.map { |project| { id: project.id, title: project.title } } + end end |