mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-11 15:45:34 +08:00
Allow inviting of existing, unconfirmed users
Closes SCI-676.
This commit is contained in:
parent
01b01939f3
commit
04749c3b2c
3 changed files with 10 additions and 13 deletions
|
@ -85,11 +85,6 @@ module Users
|
|||
UserOrganization.where(user: user, organization: @org).first
|
||||
|
||||
result[:status] = :user_exists_and_in_org
|
||||
elsif result[:status] == :user_exists && !user.confirmed?
|
||||
# We don't want to allow inviting unconfirmed
|
||||
# users (that were not invited as part of this action)
|
||||
# into organizations
|
||||
result[:status] = :user_exists_unconfirmed
|
||||
else
|
||||
# Also generate user organization relation
|
||||
user_org = UserOrganization.new(
|
||||
|
@ -106,7 +101,9 @@ module Users
|
|||
user_org.organization
|
||||
)
|
||||
|
||||
if result[:status] == :user_exists
|
||||
if result[:status] == :user_exists && !user.confirmed?
|
||||
result[:status] = :user_exists_unconfirmed_invited_to_org
|
||||
elsif result[:status] == :user_exists
|
||||
result[:status] = :user_exists_invited_to_org
|
||||
else
|
||||
result[:status] = :user_created_invited_to_org
|
||||
|
|
|
@ -10,18 +10,18 @@
|
|||
-
|
||||
<%= t('invite_users.results.user_exists') %>
|
||||
</div>
|
||||
<% elsif result[:status] == :user_exists_unconfirmed %>
|
||||
<div class="alert alert-info" role="alert">
|
||||
<strong><%= result[:email] %></strong>
|
||||
-
|
||||
<%= t('invite_users.results.user_exists_unconfirmed', organization: @org.name) %>
|
||||
</div>
|
||||
<% elsif result[:status] == :user_exists_and_in_org %>
|
||||
<div class="alert alert-info" role="alert">
|
||||
<strong><%= result[:email] %></strong>
|
||||
-
|
||||
<%= t('invite_users.results.user_exists_and_in_org', organization: @org.name, role: t("user_organizations.enums.role.#{result[:user_org].role}")) %>
|
||||
</div>
|
||||
<% elsif result[:status] == :user_exists_unconfirmed_invited_to_org %>
|
||||
<div class="alert alert-info" role="alert">
|
||||
<strong><%= result[:email] %></strong>
|
||||
-
|
||||
<%= t('invite_users.results.user_exists_unconfirmed_invited_to_org', organization: @org.name, role: t("user_organizations.enums.role.#{result[:user_org].role}")) %>
|
||||
</div>
|
||||
<% elsif result[:status] == :user_exists_invited_to_org %>
|
||||
<div class="alert alert-info" role="alert">
|
||||
<strong><%= result[:email] %></strong>
|
||||
|
|
|
@ -1439,7 +1439,7 @@ en:
|
|||
results:
|
||||
heading: "Invitation results:"
|
||||
user_exists: "User is already a member of sciNote."
|
||||
user_exists_unconfirmed: "User is already a member of sciNote but is not confirmed yet - cannot invite to team %{organization}."
|
||||
user_exists_unconfirmed_invited_to_org: "User is already a member of sciNote but is not confirmed yet - successfully invited to team %{organization} as %{role}."
|
||||
user_exists_and_in_org: "User is already a member of sciNote and team %{organization} as %{role}."
|
||||
user_exists_invited_to_org: "User was already a member of sciNote - successfully invited to team %{organization} as %{role}."
|
||||
user_created: "User succesfully invited to sciNote."
|
||||
|
|
Loading…
Add table
Reference in a new issue