diff --git a/app/assets/javascripts/users/settings/teams/invite_users_modal.js b/app/assets/javascripts/users/settings/teams/invite_users_modal.js index 0e642e40e..402238aa3 100644 --- a/app/assets/javascripts/users/settings/teams/invite_users_modal.js +++ b/app/assets/javascripts/users/settings/teams/invite_users_modal.js @@ -70,7 +70,7 @@ }); }); - dropdownSelector.init('#role', { + dropdownSelector.init(roleInput, { noEmptyOption: true, singleSelect: true, closeOnSelect: true, @@ -138,7 +138,7 @@ var data = { emails: dropdownSelector.getValues(emailsInput), team_ids: dropdownSelector.getValues(teamsInput), - role: dropdownSelector.getValues(roleInput), + role_id: dropdownSelector.getValues(roleInput), 'g-recaptcha-response': $('.g-recaptcha-response').val() }; diff --git a/app/controllers/users/invitations_controller.rb b/app/controllers/users/invitations_controller.rb index c9cd54950..4b0b86cd6 100644 --- a/app/controllers/users/invitations_controller.rb +++ b/app/controllers/users/invitations_controller.rb @@ -93,7 +93,7 @@ module Users end if @teams.any? && user - @user_role ||= UserRole.find_by(name: UserRole.public_send('normal_user_role').name) + @user_role ||= UserRole.find_predefined_normal_user_role @teams.each do |team| if team.user_assignments.exists?(user: user) result[:status] = :user_exists_and_in_team diff --git a/app/views/shared/_invite_users_modal.html.erb b/app/views/shared/_invite_users_modal.html.erb index 4c94e2ed9..3c71d84ce 100644 --- a/app/views/shared/_invite_users_modal.html.erb +++ b/app/views/shared/_invite_users_modal.html.erb @@ -114,7 +114,7 @@ invite_with_team_selector = type.in?(%w(invite_new_members invite_with_team_sele