diff --git a/app/controllers/admin/accounts_controller.rb b/app/controllers/admin/accounts_controller.rb index 3965631bd5f213..05ad56e6d79c99 100644 --- a/app/controllers/admin/accounts_controller.rb +++ b/app/controllers/admin/accounts_controller.rb @@ -9,7 +9,7 @@ class AccountsController < BaseController def index authorize :account, :index? - @accounts = filtered_accounts.page(params[:page]) + @accounts = filtered_accounts.page(params[:page]).without_count @form = Form::AccountBatch.new end diff --git a/app/controllers/admin/custom_emojis_controller.rb b/app/controllers/admin/custom_emojis_controller.rb index d54bda43857897..b9af1371682931 100644 --- a/app/controllers/admin/custom_emojis_controller.rb +++ b/app/controllers/admin/custom_emojis_controller.rb @@ -7,7 +7,7 @@ class CustomEmojisController < BaseController def index authorize :custom_emoji, :index? - @custom_emojis = filtered_custom_emojis.eager_load(:local_counterpart).page(params[:page]) + @custom_emojis = filtered_custom_emojis.eager_load(:local_counterpart).page(params[:page]).without_count @form = Form::CustomEmojiBatch.new end diff --git a/app/views/admin/accounts/index.html.haml b/app/views/admin/accounts/index.html.haml index 81c92fecb17ca7..21938da6d67bc2 100644 --- a/app/views/admin/accounts/index.html.haml +++ b/app/views/admin/accounts/index.html.haml @@ -58,13 +58,13 @@ = f.button safe_join([fa_icon('times'), t('admin.accounts.reject')]), name: :reject_remote, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') } = f.button safe_join([fa_icon('lock'), t('admin.accounts.perform_full_suspension')]), name: :suspend, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') } - - if @accounts.total_count > @accounts.size + - if @accounts.size >= 40 .batch-table__select-all .not-selected.active %span= t('generic.all_items_on_page_selected_html', count: @accounts.size) - %button{ type: 'button' }= t('generic.select_all_matching_items', count: @accounts.total_count) + %button{ type: 'button' }= t('generic.select_all_matching_items', count: '>40') .selected - %span= t('generic.all_matching_items_selected_html', count: @accounts.total_count) + %span= t('generic.all_matching_items_selected_html', count: '>40') %button{ type: 'button' }= t('generic.deselect') .batch-table__body - if @accounts.empty? @@ -72,4 +72,6 @@ - else = render partial: 'account', collection: @accounts, locals: { f: f } -= paginate @accounts +%nav.pagination + = link_to_previous_page @accounts, safe_join([fa_icon('chevron-left'), t('pagination.prev')], ' '), rel: 'prev' + = link_to_next_page @accounts, safe_join([t('pagination.next'), fa_icon('chevron-right')], ' '), rel: 'next' diff --git a/app/views/admin/custom_emojis/index.html.haml b/app/views/admin/custom_emojis/index.html.haml index 8b4e93ac3594ff..d1cab782689a85 100644 --- a/app/views/admin/custom_emojis/index.html.haml +++ b/app/views/admin/custom_emojis/index.html.haml @@ -81,4 +81,6 @@ - else = render partial: 'custom_emoji', collection: @custom_emojis, locals: { f: f } -= paginate @custom_emojis +%nav.pagination + = link_to_previous_page @custom_emojis, safe_join([fa_icon('chevron-left'), t('pagination.prev')], ' '), rel: 'prev' + = link_to_next_page @custom_emojis, safe_join([t('pagination.next'), fa_icon('chevron-right')], ' '), rel: 'next' diff --git a/db/post_migrate/20240217215134_improve_remote_pending_accounts_index.rb b/db/post_migrate/20240217215134_improve_remote_pending_accounts_index.rb new file mode 100644 index 00000000000000..66d5e0d180187e --- /dev/null +++ b/db/post_migrate/20240217215134_improve_remote_pending_accounts_index.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class ImproveRemotePendingAccountsIndex < ActiveRecord::Migration[7.1] + disable_ddl_transaction! + + def change + remove_index :accounts, :remote_pending, unique: false, algorithm: :concurrently + + add_index :accounts, :id, name: 'index_remote_pending_users', unique: false, algorithm: :concurrently, where: 'domain IS NOT NULL AND remote_pending AND suspended_at IS NOT NULL' + end +end diff --git a/db/schema.rb b/db/schema.rb index 3a6df543437dbb..0b1b5c863cb379 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_02_17_093511) do +ActiveRecord::Schema[7.1].define(version: 2024_02_17_215134) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -198,8 +198,8 @@ t.index "(((setweight(to_tsvector('simple'::regconfig, (display_name)::text), 'A'::\"char\") || setweight(to_tsvector('simple'::regconfig, (username)::text), 'B'::\"char\")) || setweight(to_tsvector('simple'::regconfig, (COALESCE(domain, ''::character varying))::text), 'C'::\"char\")))", name: "search_index", using: :gin t.index "lower((username)::text), COALESCE(lower((domain)::text), ''::text)", name: "index_accounts_on_username_and_domain_lower", unique: true t.index ["domain", "id"], name: "index_accounts_on_domain_and_id" + t.index ["id"], name: "index_accounts_on_id", where: "((domain IS NOT NULL) AND remote_pending AND (suspended_at IS NOT NULL))" t.index ["moved_to_account_id"], name: "index_accounts_on_moved_to_account_id", where: "(moved_to_account_id IS NOT NULL)" - t.index ["remote_pending"], name: "index_accounts_on_remote_pending" t.index ["uri"], name: "index_accounts_on_uri" t.index ["url"], name: "index_accounts_on_url", opclass: :text_pattern_ops, where: "(url IS NOT NULL)" end