mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-10 17:36:33 +08:00
Fix user adding/removing from a team [SCI-7240]
This commit is contained in:
parent
a3ea6e608c
commit
b675fb14eb
4 changed files with 6 additions and 8 deletions
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 %>
|
||||
<p><%= t("users.settings.user_teams.leave_uo_message", team: user_team.team.name) %></p>
|
||||
<p><%= t("users.settings.user_teams.leave_uo_message", team: @user_assignment.team.name) %></p>
|
||||
<div class="alert alert-danger" role="alert">
|
||||
<span class="fas fa-exclamation-triangle"></span>
|
||||
|
||||
|
|
Loading…
Reference in a new issue