diff --git a/app/controllers/api/members_controller.rb b/app/controllers/api/members_controller.rb
index 43e1dd3c..a3866aaa 100644
--- a/app/controllers/api/members_controller.rb
+++ b/app/controllers/api/members_controller.rb
@@ -83,11 +83,19 @@ def update
def destroy
authorize User
+ STDERR.puts "IN THE DESTROY FUNCTION"
@member.soft_destroy
sign_out(@member) unless current_user.is_admin?
head :no_content
end
+ def activate
+ @member = User.friendly.find(params[:id])
+ STDERR.puts "IN THE ACTIVATE FUNCTION"
+ @member.activate_member
+ head :no_content
+ end
+
# export subscriptions
def export_subscriptions
authorize :export
@@ -168,7 +176,7 @@ def merge
def list
authorize User
- p = params.require(:query).permit(:search, :order_by, :page, :size)
+ p = params.require(:query).permit(:search, :order_by, :page, :size, :is_active)
unless p[:page].is_a? Integer
render json: {error: 'page must be an integer'}, status: :unprocessable_entity
@@ -201,7 +209,7 @@ def list
@query = User.includes(:profile, :group, :subscriptions)
.joins(:profile, :group, :roles, 'LEFT JOIN "subscriptions" ON "subscriptions"."user_id" = "users"."id" LEFT JOIN "plans" ON "plans"."id" = "subscriptions"."plan_id"')
- .where("users.is_active = 'true' AND roles.name = 'member'")
+ .where("users.is_active = #{p[:is_active]} AND roles.name = 'member'")
.order("#{order_key} #{direction}")
.page(p[:page])
.per(p[:size])
diff --git a/app/models/user.rb b/app/models/user.rb
index 98e9e0e6..a6063603 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -135,7 +135,11 @@ def stripe_customer
def soft_destroy
update_attribute(:is_active, false)
- uninvolve_from_projects
+ # uninvolve_from_projects
+ end
+
+ def activate_member
+ update_attribute(:is_active, true)
end
def uninvolve_from_projects
diff --git a/config/locales/app.admin.en.yml b/config/locales/app.admin.en.yml
index dd630626..d2cfc278 100644
--- a/config/locales/app.admin.en.yml
+++ b/config/locales/app.admin.en.yml
@@ -418,6 +418,8 @@ en:
authentication: "Authentication"
do_you_really_want_to_delete_this_administrator_this_cannot_be_undone: "Do you really want to delete this administrator? This cannot be undone."
do_you_really_want_to_remove_this_member: "Do you really want to remove this member? It will be marked as inactive and will be hidden."
+ do_you_really_want_to_pause_this_member: "Do you really want to pause this member account?"
+ warning_account_marked_as_inactive: "It will be marked as inactive and will no longer be able to access the features for members in the platform until its account is reactivated."
notice_member_projects_will_be_deleted: "All of the user project records will be deleted. This can not be undone."
warning_if_multiple_period_suscription_is_active: "Warning: If the user has a current enrollment membership with multiple payment periods, the subscription must be stoped from the Stripe account dashboard."
this_may_take_a_while_please_wait: "Warning: This may take a while, please be patient."
@@ -439,6 +441,10 @@ en:
state: "State"
unknown: "Unknown: "
active: "Active"
+ member_is_active: "Do you really want to active this member?"
+ member_successfully_active: "Member successfully active"
+ unable_to_active_the_member: "Unable to active Member"
+ deactivate_members: "Deactivate Members"
pending: "Pending"
previous_provider: "Previous provider"
do_you_really_want_to_delete_the_TYPE_authentication_provider_NAME: "Do you really want to delete the {{TYPE}} authentication provider: {{NAME}}?" # angular interpolation
diff --git a/config/locales/app.admin.es.yml b/config/locales/app.admin.es.yml
index 3e446aef..2e01787c 100644
--- a/config/locales/app.admin.es.yml
+++ b/config/locales/app.admin.es.yml
@@ -414,6 +414,8 @@ es:
groups: "Grupos"
authentication: "Autenticación"
do_you_really_want_to_delete_this_administrator_this_cannot_be_undone: "¿Desea realmente eliminar este administrador? Esto no se puede deshacer."
+ do_you_really_want_to_pause_this_member: "¿Desea realmente pausar este usuario?."
+ warning_account_marked_as_inactive: "Se marcará como inactivo y ya no podrá acceder a las funciones para los usuarios de la plataforma hasta que se reactive su cuenta."
this_may_take_a_while_please_wait: "Advertencia: esto puede tomar un tiempo, por favor, tenga paciencia."
administrator_successfully_deleted: "Administrador eliminado correctamente."
unable_to_delete_the_administrator: "No se puede eliminar el administrador."
diff --git a/config/locales/app.admin.fr.yml b/config/locales/app.admin.fr.yml
index a9b70a40..e2fd54bc 100644
--- a/config/locales/app.admin.fr.yml
+++ b/config/locales/app.admin.fr.yml
@@ -414,6 +414,8 @@ fr:
groups: "Groupes"
authentication: "Authentification"
do_you_really_want_to_delete_this_administrator_this_cannot_be_undone: "Êtes-vous sûr de vouloir supprimer cet administrateur ? Cette opération est irréversible."
+ do_you_really_want_to_pause_this_member: "Voulez-vous vraiment mettre en pause ce compte membre?"
+ warning_account_marked_as_inactive: "Il sera marqué comme inactif et ne pourra plus accéder aux fonctionnalités des membres de la plate-forme tant que son compte ne sera pas réactivé."
this_may_take_a_while_please_wait: "Attention : ceci peut prendre un certain temps, merci de patienter."
administrator_successfully_deleted: "L'administrateur a bien été supprimé."
unable_to_delete_the_administrator: "L'administrateur n'a pas pu être supprimé."
diff --git a/config/locales/app.admin.pt.yml b/config/locales/app.admin.pt.yml
index d001316f..eba8a663 100755
--- a/config/locales/app.admin.pt.yml
+++ b/config/locales/app.admin.pt.yml
@@ -414,6 +414,8 @@ pt:
groups: "Grupos"
authentication: "Autenticação"
do_you_really_want_to_delete_this_administrator_this_cannot_be_undone: "Você realmente deseja excluir este administrador? Isso não pode ser revertido."
+ do_you_really_want_to_pause_this_member: "Você realmente deseja pausar essa conta de membro?"
+ warning_account_marked_as_inactive: "Ele será marcado como inativo e não poderá mais acessar os recursos dos membros da plataforma até que sua conta seja reativada."
this_may_take_a_while_please_wait: "Atenção: Isso pode demorar um pouco, por favor, seja paciente."
administrator_successfully_deleted: "Administrator excluído com sucesso."
unable_to_delete_the_administrator: "Impossível excluir administrador."
diff --git a/config/routes.rb b/config/routes.rb
index f582a068..a13fb467 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -51,6 +51,7 @@
post 'list', action: 'list', on: :collection
get 'search/:query', action: 'search', on: :collection
get 'mapping', action: 'mapping', on: :collection
+ post 'activate', action: 'activate', on: :collection
end
resources :reservations, only: [:show, :create, :index, :update]
resources :notifications, only: [:index, :show, :update] do