diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index f7d4dd296..52de2def6 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -86,7 +86,7 @@ class ProjectsController < ApplicationController if stale?([@product, current_team]) render json: { editable: can_manage_project?(@project), - moveable: can_update_team?(current_team), + moveable: can_manage_team?(current_team), archivable: can_archive_project?(@project), restorable: can_restore_project?(@project) } diff --git a/app/controllers/users/invitations_controller.rb b/app/controllers/users/invitations_controller.rb index 3a4fa9b6e..c9cd54950 100644 --- a/app/controllers/users/invitations_controller.rb +++ b/app/controllers/users/invitations_controller.rb @@ -64,7 +64,7 @@ module Users break end - result = { email: email, user_teams: [] } + result = { email: email } unless Constants::BASIC_EMAIL_REGEX.match?(email) result[:status] = :user_invalid @invite_results << result @@ -75,7 +75,6 @@ module Users if user result[:status] = :user_exists - result[:user] = user else user = User.invite!( full_name: email, @@ -86,7 +85,6 @@ module Users user.update(invited_by: @user) result[:status] = :user_created - result[:user] = user # Sending email invitation is done in background job to prevent # issues with email delivery. Also invite method must be call diff --git a/app/controllers/users/settings/user_teams_controller.rb b/app/controllers/users/settings/user_teams_controller.rb index 7c97fd473..36371e511 100644 --- a/app/controllers/users/settings/user_teams_controller.rb +++ b/app/controllers/users/settings/user_teams_controller.rb @@ -85,7 +85,7 @@ module Users unless invalid begin - UserTeam.transaction do + @user_assignment.transaction do # If user leaves on his/her own accord, # new owner for projects is the first # administrator of team diff --git a/app/views/users/settings/user_teams/_leave_user_team_modal_body.html.erb b/app/views/users/settings/user_teams/_leave_user_team_modal_body.html.erb index 3fe325a4b..2aa4cf8e8 100644 --- a/app/views/users/settings/user_teams/_leave_user_team_modal_body.html.erb +++ b/app/views/users/settings/user_teams/_leave_user_team_modal_body.html.erb @@ -1,10 +1,10 @@ -<%= bootstrap_form_for user_team, - url: destroy_user_team_path(user_team, format: :json), +<%= bootstrap_form_for @user_assignment, + url: destroy_user_team_path(@user_assignment, format: :json), remote: :true, method: :delete, data: { id: 'leave-user-team-form' } do |f| %> <%= hidden_field_tag :leave, true %> -

<%= t("users.settings.user_teams.leave_uo_message", team: user_team.team.name) %>

+

<%= t("users.settings.user_teams.leave_uo_message", team: @user_assignment.team.name) %>