- <% if can?(:create, User.new(account: current_account)) %>
+ <% if params[:status].blank? && can?(:create, User.new(account: current_account)) %>
<%= render 'users/extra_buttons' %>
<% if content_for(:add_user_button) %>
<%= content_for(:add_user_button) %>
@@ -57,17 +63,17 @@
<%= user.last_sign_in_at ? l(user.last_sign_in_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) : '-' %>
- <% if can?(:update, user) && user.archived_at.blank? %>
+ <% if params[:status].blank? && can?(:update, user) && user.archived_at.blank? %>
<%= link_to edit_user_path(user), class: 'btn btn-outline btn-xs', title: t('edit'), data: { turbo_frame: 'modal' } do %>
<%= t('edit') %>
<% end %>
<% end %>
- <% if params[:status].blank? && can?(:destroy, user) && user != current_user %>
+ <% if params[:status] != 'archived' && can?(:destroy, user) && user != current_user %>
<%= button_to user_path(user), method: :delete, class: 'btn btn-outline btn-error btn-xs', title: t('remove'), data: { turbo_confirm: t('are_you_sure_') } do %>
<%= t('remove') %>
<% end %>
<% end %>
- <% if params[:status].present? && can?(:manage, user) && user != current_user %>
+ <% if params[:status] == 'archived' && can?(:manage, user) && user != current_user && user.archived_at? %>
<%= button_to user_path(user), method: :put, params: { user: { archived_at: nil } }, class: 'btn btn-outline btn-xs', title: t('unarchive'), data: { turbo_confirm: t('are_you_sure_') } do %>
<%= t('unarchive') %>
<% end %>
@@ -78,22 +84,11 @@
- <% view_archived_html = capture do %>
- <% if current_account.users.archived.exists? %>
-
- <% end %>
- <% end %>
<% if @pagy.pages > 1 %>
- <%= render 'shared/pagination', pagy: @pagy, items_name: 'users', left_additional_html: view_archived_html %>
+ <%= render 'shared/pagination', pagy: @pagy, items_name: 'users', left_additional_html: render('bottom_links') %>
<% else %>
- <%= view_archived_html %>
+ <%= render 'bottom_links' %>
<% end %>
diff --git a/config/locales/i18n.yml b/config/locales/i18n.yml
index 36a27291..9655b0d9 100644
--- a/config/locales/i18n.yml
+++ b/config/locales/i18n.yml
@@ -474,7 +474,6 @@ en: &en
back: Back
add_secret: Add Secret
submission_example_payload: Submission example payload
- status_users: '%{status} Users'
there_are_no_signatures: There are no signatures
signed_with_trusted_certificate: Signed with trusted certificate
signed_with_external_certificate: Signed with external certificate
@@ -619,6 +618,10 @@ en: &en
use_international_format_1xxx_: 'Use internatioanl format: +1xxx...'
submitter_cannot_be_updated: Submitter cannot be updated.
at_least_one_field_must_be_filled: At least one field must be filled.
+ archived_users: Archived Users
+ embedding_users: Embedding Users
+ view_embedding_users: View Embedding Users
+ view_users: View Users
submission_event_names:
send_email_to_html: 'Email sent to %{submitter_name}'
send_reminder_email_to_html: 'Reminder email sent to %{submitter_name}'
@@ -1111,7 +1114,6 @@ es: &es
back: Atrás
add_secret: Agregar secreto
submission_example_payload: Ejemplo de payload de envío
- status_users: '%{status} Usuarios'
there_are_no_signatures: No hay firmas
signed_with_trusted_certificate: Firmado con certificado de confianza
signed_with_external_certificate: Firmado con certificado externo
@@ -1256,6 +1258,9 @@ es: &es
use_international_format_1xxx_: 'Usa el formato internacional: +1xxx...'
submitter_cannot_be_updated: El remitente no puede ser actualizado.
at_least_one_field_must_be_filled: Al menos un campo debe estar completo.
+ archived_users: Usuarios Archivados
+ embedding_users: Usuarios Integrados
+ view_embedding_users: Ver Usuarios Integrado
submission_event_names:
send_email_to_html: 'Correo electrónico enviado a %{submitter_name}'
send_reminder_email_to_html: 'Correo de recordatorio enviado a %{submitter_name}'
@@ -1748,7 +1753,6 @@ it: &it
back: Indietro
add_secret: Aggiungi segreto
submission_example_payload: Esempio di payload di invio
- status_users: '%{status} Utenti'
there_are_no_signatures: Non ci sono firme
signed_with_trusted_certificate: Firmato con certificato affidabile
signed_with_external_certificate: Firmato con certificato esterno
@@ -1893,6 +1897,9 @@ it: &it
use_international_format_1xxx_: 'Utilizza il formato internazionale: +1xxx...'
submitter_cannot_be_updated: Il mittente non può essere aggiornato.
at_least_one_field_must_be_filled: Almeno un campo deve essere compilato.
+ archived_users: Utenti Archiviati
+ embedding_users: Utenti Incorporati
+ view_embedding_users: Visualizza Utenti Incorporati
submission_event_names:
send_email_to_html: 'E-mail inviato a %{submitter_name}'
send_reminder_email_to_html: 'E-mail di promemoria inviato a %{submitter_name}'
@@ -2386,7 +2393,6 @@ fr: &fr
back: Retour
add_secret: Ajouter un secret
submission_example_payload: Exemple de payload de soumission
- status_users: '%{status} Utilisateurs'
there_are_no_signatures: "Il n'y a pas de signatures"
signed_with_trusted_certificate: Signé avec un certificat de confiance
signed_with_external_certificate: Signé avec un certificat externe
@@ -2531,6 +2537,9 @@ fr: &fr
use_international_format_1xxx_: 'Utilizza il formato internazionale: +1xxx...'
submitter_cannot_be_updated: Il mittente non può essere aggiornato.
at_least_one_field_must_be_filled: Almeno un campo deve essere compilato.
+ archived_users: Utilisateurs Archivés
+ embedding_users: Utilisateurs Intégrés
+ view_embedding_users: Voir les Utilisateurs Intégrés
submission_event_names:
send_email_to_html: 'E-mail envoyé à %{submitter_name}'
send_reminder_email_to_html: 'E-mail de rappel envoyé à %{submitter_name}'
@@ -3023,7 +3032,6 @@ pt: &pt
back: Voltar
add_secret: Adicionar segredo
submission_example_payload: Exemplo de payload de submissão
- status_users: '%{status} Usuários'
there_are_no_signatures: Não há assinaturas
signed_with_trusted_certificate: Assinado com certificado confiável
signed_with_external_certificate: Assinado com certificado externo
@@ -3168,6 +3176,9 @@ pt: &pt
use_international_format_1xxx_: 'Use o formato internacional: +1xxx...'
submitter_cannot_be_updated: O remetente não pode ser atualizado.
at_least_one_field_must_be_filled: Pelo menos um campo deve ser preenchido.
+ archived_users: Usuários Arquivados
+ embedding_users: Usuários Incorporados
+ view_embedding_users: Ver Usuários Incorporados
submission_event_names:
send_email_to_html: 'E-mail enviado para %{submitter_name}'
send_reminder_email_to_html: 'E-mail de lembrete enviado para %{submitter_name}'
@@ -3660,7 +3671,6 @@ de: &de
back: Zurück
add_secret: Geheimnis hinzufügen
submission_example_payload: Beispiel-Payload für Einreichung
- status_users: '%{status} Benutzer'
there_are_no_signatures: Es gibt keine Unterschriften
signed_with_trusted_certificate: Signiert mit vertrauenswürdigem Zertifikat
signed_with_external_certificate: Signiert mit externem Zertifikat
@@ -3805,6 +3815,9 @@ de: &de
use_international_format_1xxx_: 'Verwenden Sie das internationale Format: +1xxx...'
submitter_cannot_be_updated: Der Absender kann nicht aktualisiert werden.
at_least_one_field_must_be_filled: Mindestens ein Feld muss ausgefüllt werden.
+ archived_users: Archivierte Benutzer
+ embedding_users: Einbettende Benutzer
+ view_embedding_users: Einbettende Benutzer anzeigen
submission_event_names:
send_email_to_html: 'E-Mail gesendet an %{submitter_name}'
send_reminder_email_to_html: 'Erinnerungs-E-Mail gesendet an %{submitter_name}'
diff --git a/config/routes.rb b/config/routes.rb
index 57f6a830..389d6f50 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -162,6 +162,8 @@ Rails.application.routes.draw do
resources :users, only: %i[index]
resources :archived_users, only: %i[index], path: 'users/:status', controller: 'users',
defaults: { status: :archived }
+ resources :integration_users, only: %i[index], path: 'users/:status', controller: 'users',
+ defaults: { status: :integration }
resource :personalization, only: %i[show create], controller: 'personalization_settings'
resources :api, only: %i[index create], controller: 'api_settings'
resource :webhooks, only: %i[show create update], controller: 'webhook_settings'
diff --git a/spec/system/team_settings_spec.rb b/spec/system/team_settings_spec.rb
index c3c35832..3472917a 100644
--- a/spec/system/team_settings_spec.rb
+++ b/spec/system/team_settings_spec.rb
@@ -18,13 +18,19 @@ RSpec.describe 'Team Settings' do
visit settings_users_path
end
- it 'shows all users' do
+ it 'shows only active users' do
within '.table' do
users.each do |user|
expect(page).to have_content(user.full_name)
expect(page).to have_content(user.email)
- expect(page).to have_no_content(other_user.email)
+ expect(page).to have_link('Edit', href: edit_user_path(user))
end
+
+ expect(page).to have_button('Remove')
+ expect(page).to have_no_button('Unarchive')
+
+ expect(page).to have_no_content(other_user.full_name)
+ expect(page).to have_no_content(other_user.email)
end
end
@@ -89,4 +95,58 @@ RSpec.describe 'Team Settings' do
expect(page).to have_no_content('User has been removed')
end
end
+
+ context 'when some users are archived' do
+ let!(:users) { create_list(:user, 2, account:) }
+ let!(:archived_users) { create_list(:user, 2, account:, archived_at: Time.current) }
+ let!(:other_user) { create(:user) }
+
+ it 'shows only active users' do
+ visit settings_users_path
+
+ within '.table' do
+ users.each do |user|
+ expect(page).to have_content(user.full_name)
+ expect(page).to have_content(user.email)
+ end
+
+ archived_users.each do |user|
+ expect(page).to have_no_content(user.full_name)
+ expect(page).to have_no_content(user.email)
+ end
+
+ expect(page).to have_no_content(other_user.full_name)
+ expect(page).to have_no_content(other_user.email)
+ end
+
+ expect(page).to have_link('View Archived', href: settings_archived_users_path)
+ end
+
+ it 'shows only archived users' do
+ visit settings_archived_users_path
+
+ within '.table' do
+ archived_users.each do |user|
+ expect(page).to have_content(user.full_name)
+ expect(page).to have_content(user.email)
+ expect(page).to have_no_link('Edit', href: edit_user_path(user))
+ end
+
+ users.each do |user|
+ expect(page).to have_no_content(user.full_name)
+ expect(page).to have_no_content(user.email)
+ expect(page).to have_no_link('Edit', href: edit_user_path(user))
+ end
+
+ expect(page).to have_button('Unarchive')
+ expect(page).to have_no_button('Remove')
+
+ expect(page).to have_no_content(other_user.full_name)
+ expect(page).to have_no_content(other_user.email)
+ end
+
+ expect(page).to have_content('Archived Users')
+ expect(page).to have_link('View Active', href: settings_users_path)
+ end
+ end
end
|