diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/hidden_users_controller.rb similarity index 92% rename from app/controllers/admin/users_controller.rb rename to app/controllers/admin/hidden_users_controller.rb index 1e17e1c2d..8237b7fd4 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/hidden_users_controller.rb @@ -1,4 +1,4 @@ -class Admin::UsersController < Admin::BaseController +class Admin::HiddenUsersController < Admin::BaseController has_filters %w{without_confirmed_hide all with_confirmed_hide}, only: :index before_action :load_user, only: [:confirm_hide, :restore] @@ -30,4 +30,4 @@ class Admin::UsersController < Admin::BaseController @user = User.with_hidden.find(params[:id]) end -end \ No newline at end of file +end diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index 8ca439a1c..ad5dccc73 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -17,7 +17,7 @@ module AdminHelper end def menu_moderated_content? - ["proposals", "debates", "comments", "users"].include? controller_name + ["proposals", "debates", "comments", "hidden_users"].include? controller_name end def menu_budget? diff --git a/app/views/admin/_menu.html.erb b/app/views/admin/_menu.html.erb index 5d454fcd8..573e66a16 100644 --- a/app/views/admin/_menu.html.erb +++ b/app/views/admin/_menu.html.erb @@ -33,8 +33,8 @@ <%= link_to t("admin.menu.hidden_comments"), admin_comments_path %> -
  • > - <%= link_to t("admin.menu.hidden_users"), admin_users_path %> +
  • > + <%= link_to t("admin.menu.hidden_users"), admin_hidden_users_path %>
  • diff --git a/app/views/admin/budget_investments/_written_by_author.html.erb b/app/views/admin/budget_investments/_written_by_author.html.erb index b2c46c6f5..2ecfa2068 100644 --- a/app/views/admin/budget_investments/_written_by_author.html.erb +++ b/app/views/admin/budget_investments/_written_by_author.html.erb @@ -16,7 +16,7 @@

    <%= t("admin.budget_investments.show.by") %>: - <%= link_to @investment.author.name, admin_user_path(@investment.author) %> + <%= link_to @investment.author.name, admin_hidden_user_path(@investment.author) %>

    diff --git a/app/views/admin/users/index.html.erb b/app/views/admin/hidden_users/index.html.erb similarity index 62% rename from app/views/admin/users/index.html.erb rename to app/views/admin/hidden_users/index.html.erb index 336443055..21bf016e4 100644 --- a/app/views/admin/users/index.html.erb +++ b/app/views/admin/hidden_users/index.html.erb @@ -1,6 +1,6 @@ -

    <%= t("admin.users.index.title") %>

    +

    <%= t("admin.hidden_users.index.title") %>

    -<%= render 'shared/filter_subnav', i18n_namespace: "admin.users.index" %> +<%= render 'shared/filter_subnav', i18n_namespace: "admin.hidden_users.index" %>

    <%= page_entries_info @users %>

    @@ -8,18 +8,18 @@ <% @users.each do |user| %> -

    <%= link_to user.name, admin_user_path(user) %>

    +

    <%= link_to user.name, admin_hidden_user_path(user) %>

    <%= link_to t("admin.actions.restore"), - restore_admin_user_path(user, request.query_parameters), + restore_admin_hidden_user_path(user, request.query_parameters), method: :put, data: { confirm: t("admin.actions.confirm") }, class: "button hollow on-hover" %> <% unless user.confirmed_hide? %> <%= link_to t("admin.actions.confirm_hide"), - confirm_hide_admin_user_path(user, request.query_parameters), + confirm_hide_admin_hidden_user_path(user, request.query_parameters), method: :put, class: "button hollow warning on-hover" %> <% end %> diff --git a/app/views/admin/users/show.html.erb b/app/views/admin/hidden_users/show.html.erb similarity index 64% rename from app/views/admin/users/show.html.erb rename to app/views/admin/hidden_users/show.html.erb index 1a6ab9795..9fe69ef44 100644 --- a/app/views/admin/users/show.html.erb +++ b/app/views/admin/hidden_users/show.html.erb @@ -1,11 +1,11 @@ <%= render 'shared/back_link' %> -

    <%= t("admin.users.show.title", user: @user.name) %>

    +

    <%= t("admin.hidden_users.show.title", user: @user.name) %>

    - <%= t("admin.users.show.email") %> <%= @user.email %> | - <%= t("admin.users.show.registered_at") %> <%= @user.confirmed_at %> | - <%= t("admin.users.show.hidden_at") %> <%= @user.hidden_at %> + <%= t("admin.hidden_users.show.email") %> <%= @user.email %> | + <%= t("admin.hidden_users.show.registered_at") %> <%= @user.confirmed_at %> | + <%= t("admin.hidden_users.show.hidden_at") %> <%= @user.hidden_at %>

    <% if @debates.present? %> diff --git a/app/views/admin/spending_proposals/_written_by_author.html.erb b/app/views/admin/spending_proposals/_written_by_author.html.erb index 8440666e5..acb7db69c 100644 --- a/app/views/admin/spending_proposals/_written_by_author.html.erb +++ b/app/views/admin/spending_proposals/_written_by_author.html.erb @@ -16,7 +16,7 @@

    <%= t("admin.spending_proposals.show.by") %>: - <%= link_to @spending_proposal.author.name, admin_user_path(@spending_proposal.author) %> + <%= link_to @spending_proposal.author.name, admin_hidden_user_path(@spending_proposal.author) %>

    diff --git a/app/views/admin/verifications/index.html.erb b/app/views/admin/verifications/index.html.erb index 97cca3a4e..c8b2c6ade 100644 --- a/app/views/admin/verifications/index.html.erb +++ b/app/views/admin/verifications/index.html.erb @@ -8,7 +8,7 @@ <% @users.each do |user| %> - <%= link_to user.name, admin_user_path(user) %> + <%= link_to user.name, admin_hidden_user_path(user) %> <%= render "pending_step", user: user %> @@ -17,4 +17,4 @@ <% end %> -<%= paginate @users %> \ No newline at end of file +<%= paginate @users %> diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml index 56cc52a78..7ef52a670 100644 --- a/config/i18n-tasks.yml +++ b/config/i18n-tasks.yml @@ -126,7 +126,7 @@ ignore_unused: - 'admin.budget_investments.index.filter*' - 'admin.spending_proposals.index.filter*' - 'admin.organizations.index.filter*' - - 'admin.users.index.filter*' + - 'admin.hidden_users.index.filter*' - 'admin.activity.show.filter*' - 'admin.legislation.processes.index.filter*' - 'admin.legislation.processes.*.submit_button' diff --git a/config/locales/admin.en.yml b/config/locales/admin.en.yml index 1f7eef0a5..fa353ec63 100755 --- a/config/locales/admin.en.yml +++ b/config/locales/admin.en.yml @@ -181,6 +181,19 @@ en: with_confirmed_hide: Confirmed without_confirmed_hide: Pending title: Hidden debates + hidden_users: + index: + filter: Filter + filters: + all: All + with_confirmed_hide: Confirmed + without_confirmed_hide: Pending + title: Hidden users + show: + email: 'Email:' + hidden_at: 'Hidden at:' + registered_at: 'Registered at:' + title: Activity of user (%{user}) legislation: processes: create: @@ -803,19 +816,6 @@ en: name: placeholder: Type the name of the topic update: Update Topic - users: - index: - filter: Filter - filters: - all: All - with_confirmed_hide: Confirmed - without_confirmed_hide: Pending - title: Hidden users - show: - email: 'Email:' - hidden_at: 'Hidden at:' - registered_at: 'Registered at:' - title: Activity of user (%{user}) verifications: index: phone_not_given: Phone not given diff --git a/config/locales/admin.es.yml b/config/locales/admin.es.yml index bdcfa2e6e..c842403f6 100644 --- a/config/locales/admin.es.yml +++ b/config/locales/admin.es.yml @@ -181,6 +181,19 @@ es: with_confirmed_hide: Confirmados without_confirmed_hide: Pendientes title: Debates ocultos + hidden_users: + index: + filter: Filtro + filters: + all: Todos + with_confirmed_hide: Confirmados + without_confirmed_hide: Pendientes + title: Usuarios bloqueados + show: + email: 'Email:' + hidden_at: 'Bloqueado:' + registered_at: 'Fecha de alta:' + title: Actividad del usuario (%{user}) legislation: processes: create: @@ -803,19 +816,6 @@ es: name: placeholder: Escribe el nombre del tema update: Actualizar Tema - users: - index: - filter: Filtro - filters: - all: Todos - with_confirmed_hide: Confirmados - without_confirmed_hide: Pendientes - title: Usuarios bloqueados - show: - email: 'Email:' - hidden_at: 'Bloqueado:' - registered_at: 'Fecha de alta:' - title: Actividad del usuario (%{user}) verifications: index: phone_not_given: No ha dado su teléfono diff --git a/config/routes.rb b/config/routes.rb index 355a4da3f..1d895be09 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -161,7 +161,7 @@ Rails.application.routes.draw do end end - resources :users, only: [:index, :show] do + resources :hidden_users, only: [:index, :show] do member do put :restore put :confirm_hide diff --git a/spec/features/admin/activity_spec.rb b/spec/features/admin/activity_spec.rb index 0bc1d7b6b..9a1f8aaf8 100644 --- a/spec/features/admin/activity_spec.rb +++ b/spec/features/admin/activity_spec.rb @@ -314,7 +314,7 @@ feature 'Admin activity' do scenario "Shows admin restores" do user = create(:user, :hidden) - visit admin_users_path + visit admin_hidden_users_path within("#user_#{user.id}") do click_on "Restore" @@ -331,4 +331,4 @@ feature 'Admin activity' do end end -end \ No newline at end of file +end diff --git a/spec/features/admin/users_spec.rb b/spec/features/admin/hidden_users_spec.rb similarity index 82% rename from spec/features/admin/users_spec.rb rename to spec/features/admin/hidden_users_spec.rb index 0bd999ff1..f229bd833 100644 --- a/spec/features/admin/users_spec.rb +++ b/spec/features/admin/hidden_users_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -feature 'Admin users' do +feature 'Admin hidden users' do background do admin = create(:administrator) @@ -15,7 +15,7 @@ feature 'Admin users' do comment1 = create(:comment, :hidden, user: user, commentable: debate2, body: "You have the manners of a beggar") comment2 = create(:comment, user: user, commentable: debate2, body: 'Not Spam') - visit admin_user_path(user) + visit admin_hidden_user_path(user) expect(page).to have_content(debate1.title) expect(page).to have_content(debate2.title) @@ -25,7 +25,7 @@ feature 'Admin users' do scenario 'Restore' do user = create(:user, :hidden) - visit admin_users_path + visit admin_hidden_users_path click_link 'Restore' @@ -36,7 +36,7 @@ feature 'Admin users' do scenario 'Confirm hide' do user = create(:user, :hidden) - visit admin_users_path + visit admin_hidden_users_path click_link 'Confirm' @@ -48,22 +48,22 @@ feature 'Admin users' do end scenario "Current filter is properly highlighted" do - visit admin_users_path + visit admin_hidden_users_path expect(page).to_not have_link('Pending') expect(page).to have_link('All') expect(page).to have_link('Confirmed') - visit admin_users_path(filter: 'Pending') + visit admin_hidden_users_path(filter: 'Pending') expect(page).to_not have_link('Pending') expect(page).to have_link('All') expect(page).to have_link('Confirmed') - visit admin_users_path(filter: 'all') + visit admin_hidden_users_path(filter: 'all') expect(page).to have_link('Pending') expect(page).to_not have_link('All') expect(page).to have_link('Confirmed') - visit admin_users_path(filter: 'with_confirmed_hide') + visit admin_hidden_users_path(filter: 'with_confirmed_hide') expect(page).to have_link('All') expect(page).to have_link('Pending') expect(page).to_not have_link('Confirmed') @@ -73,11 +73,11 @@ feature 'Admin users' do create(:user, :hidden, username: "Unconfirmed") create(:user, :hidden, :with_confirmed_hide, username: "Confirmed user") - visit admin_users_path(filter: 'all') + visit admin_hidden_users_path(filter: 'all') expect(page).to have_content('Unconfirmed') expect(page).to have_content('Confirmed user') - visit admin_users_path(filter: 'with_confirmed_hide') + visit admin_hidden_users_path(filter: 'with_confirmed_hide') expect(page).to_not have_content('Unconfirmed') expect(page).to have_content('Confirmed user') end @@ -86,7 +86,7 @@ feature 'Admin users' do per_page = Kaminari.config.default_per_page (per_page + 2).times { create(:user, :hidden, :with_confirmed_hide) } - visit admin_users_path(filter: 'with_confirmed_hide', page: 2) + visit admin_hidden_users_path(filter: 'with_confirmed_hide', page: 2) click_on('Restore', match: :first, exact: true)