From 67f54c4e75aeaa78ba72e10603b43a713929fcbd Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 23 Jan 2024 04:06:53 -0500 Subject: [PATCH 1/9] Fix `Rails/WhereExists` cop in app/validators (#28854) --- .rubocop_todo.yml | 2 -- app/validators/reaction_validator.rb | 2 +- app/validators/vote_validator.rb | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index a2ee32d284..4d2f11ff7b 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -88,8 +88,6 @@ Rails/WhereExists: - 'app/serializers/rest/announcement_serializer.rb' - 'app/services/activitypub/fetch_remote_status_service.rb' - 'app/services/vote_service.rb' - - 'app/validators/reaction_validator.rb' - - 'app/validators/vote_validator.rb' - 'app/workers/move_worker.rb' - 'lib/tasks/tests.rake' - 'spec/models/account_spec.rb' diff --git a/app/validators/reaction_validator.rb b/app/validators/reaction_validator.rb index 4ed3376e8b..89d83de5a2 100644 --- a/app/validators/reaction_validator.rb +++ b/app/validators/reaction_validator.rb @@ -19,7 +19,7 @@ class ReactionValidator < ActiveModel::Validator end def new_reaction?(reaction) - !reaction.announcement.announcement_reactions.where(name: reaction.name).exists? + !reaction.announcement.announcement_reactions.exists?(name: reaction.name) end def limit_reached?(reaction) diff --git a/app/validators/vote_validator.rb b/app/validators/vote_validator.rb index fa2bd223dc..e725b4c0b8 100644 --- a/app/validators/vote_validator.rb +++ b/app/validators/vote_validator.rb @@ -35,7 +35,7 @@ class VoteValidator < ActiveModel::Validator if vote.persisted? account_votes_on_same_poll(vote).where(choice: vote.choice).where.not(poll_votes: { id: vote }).exists? else - account_votes_on_same_poll(vote).where(choice: vote.choice).exists? + account_votes_on_same_poll(vote).exists?(choice: vote.choice) end end From defe5f407600e9259f6b7c0683b8d56a0349b3d9 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 23 Jan 2024 04:07:22 -0500 Subject: [PATCH 2/9] Fix `Rails/WhereExists` cop in lib/tasks (#28852) --- .rubocop_todo.yml | 1 - lib/tasks/tests.rake | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 4d2f11ff7b..c0fb7a5ce2 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -89,7 +89,6 @@ Rails/WhereExists: - 'app/services/activitypub/fetch_remote_status_service.rb' - 'app/services/vote_service.rb' - 'app/workers/move_worker.rb' - - 'lib/tasks/tests.rake' - 'spec/models/account_spec.rb' - 'spec/services/activitypub/process_collection_service_spec.rb' - 'spec/services/purge_domain_service_spec.rb' diff --git a/lib/tasks/tests.rake b/lib/tasks/tests.rake index c3a9dbfd73..45f055e218 100644 --- a/lib/tasks/tests.rake +++ b/lib/tasks/tests.rake @@ -24,7 +24,7 @@ namespace :tests do exit(1) end - if Account.where(domain: Rails.configuration.x.local_domain).exists? + if Account.exists?(domain: Rails.configuration.x.local_domain) puts 'Faux remote accounts not properly cleaned up' exit(1) end From b0207d77579e8179b683fe56711a83f5d2fb0909 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 23 Jan 2024 04:10:11 -0500 Subject: [PATCH 3/9] Add coverage for `Tag.recently_used` scope (#28850) --- app/models/tag.rb | 4 +++- spec/models/tag_spec.rb | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/app/models/tag.rb b/app/models/tag.rb index 46e55d74f9..f2168ae904 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -39,6 +39,8 @@ class Tag < ApplicationRecord HASHTAG_NAME_RE = /\A(#{HASHTAG_NAME_PAT})\z/i HASHTAG_INVALID_CHARS_RE = /[^[:alnum:]\u0E47-\u0E4E#{HASHTAG_SEPARATORS}]/ + RECENT_STATUS_LIMIT = 1000 + validates :name, presence: true, format: { with: HASHTAG_NAME_RE } validates :display_name, format: { with: HASHTAG_NAME_RE } validate :validate_name_change, if: -> { !new_record? && name_changed? } @@ -53,7 +55,7 @@ class Tag < ApplicationRecord scope :not_trendable, -> { where(trendable: false) } scope :recently_used, lambda { |account| joins(:statuses) - .where(statuses: { id: account.statuses.select(:id).limit(1000) }) + .where(statuses: { id: account.statuses.select(:id).limit(RECENT_STATUS_LIMIT) }) .group(:id).order(Arel.sql('count(*) desc')) } scope :matches_name, ->(term) { where(arel_table[:name].lower.matches(arel_table.lower("#{sanitize_sql_like(Tag.normalize(term))}%"), nil, true)) } # Search with case-sensitive to use B-tree index diff --git a/spec/models/tag_spec.rb b/spec/models/tag_spec.rb index 6177b7a25a..69aaeed0af 100644 --- a/spec/models/tag_spec.rb +++ b/spec/models/tag_spec.rb @@ -100,6 +100,38 @@ RSpec.describe Tag do end end + describe '.recently_used' do + let(:account) { Fabricate(:account) } + let(:other_person_status) { Fabricate(:status) } + let(:out_of_range) { Fabricate(:status, account: account) } + let(:older_in_range) { Fabricate(:status, account: account) } + let(:newer_in_range) { Fabricate(:status, account: account) } + let(:unused_tag) { Fabricate(:tag) } + let(:used_tag_one) { Fabricate(:tag) } + let(:used_tag_two) { Fabricate(:tag) } + let(:used_tag_on_out_of_range) { Fabricate(:tag) } + + before do + stub_const 'Tag::RECENT_STATUS_LIMIT', 2 + + other_person_status.tags << used_tag_one + + out_of_range.tags << used_tag_on_out_of_range + + older_in_range.tags << used_tag_one + older_in_range.tags << used_tag_two + + newer_in_range.tags << used_tag_one + end + + it 'returns tags used by account within last X statuses ordered most used first' do + results = described_class.recently_used(account) + + expect(results) + .to eq([used_tag_one, used_tag_two]) + end + end + describe '.find_normalized' do it 'returns tag for a multibyte case-insensitive name' do upcase_string = 'abcABCabcABCやゆよ' From d03fe2bdee45b895a907aa484128cbe96c44b847 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 23 Jan 2024 04:31:59 -0500 Subject: [PATCH 4/9] N+1 fixes for CLI maintenance command (#28847) --- lib/mastodon/cli/maintenance.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/mastodon/cli/maintenance.rb b/lib/mastodon/cli/maintenance.rb index e2ea866152..73012812fd 100644 --- a/lib/mastodon/cli/maintenance.rb +++ b/lib/mastodon/cli/maintenance.rb @@ -275,7 +275,7 @@ module Mastodon::CLI def deduplicate_users_process_email ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM users GROUP BY email HAVING count(*) > 1").each do |row| - users = User.where(id: row['ids'].split(',')).order(updated_at: :desc).to_a + users = User.where(id: row['ids'].split(',')).order(updated_at: :desc).includes(:account).to_a ref_user = users.shift say "Multiple users registered with e-mail address #{ref_user.email}.", :yellow say "e-mail will be disabled for the following accounts: #{users.map { |user| user.account.acct }.join(', ')}", :yellow @@ -289,7 +289,7 @@ module Mastodon::CLI def deduplicate_users_process_confirmation_token ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM users WHERE confirmation_token IS NOT NULL GROUP BY confirmation_token HAVING count(*) > 1").each do |row| - users = User.where(id: row['ids'].split(',')).order(created_at: :desc).to_a.drop(1) + users = User.where(id: row['ids'].split(',')).order(created_at: :desc).includes(:account).to_a.drop(1) say "Unsetting confirmation token for those accounts: #{users.map { |user| user.account.acct }.join(', ')}", :yellow users.each do |user| @@ -313,7 +313,7 @@ module Mastodon::CLI def deduplicate_users_process_password_token ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM users WHERE reset_password_token IS NOT NULL GROUP BY reset_password_token HAVING count(*) > 1").each do |row| - users = User.where(id: row['ids'].split(',')).order(updated_at: :desc).to_a.drop(1) + users = User.where(id: row['ids'].split(',')).order(updated_at: :desc).includes(:account).to_a.drop(1) say "Unsetting password reset token for those accounts: #{users.map { |user| user.account.acct }.join(', ')}", :yellow users.each do |user| @@ -591,7 +591,7 @@ module Mastodon::CLI end def deduplicate_local_accounts!(scope) - accounts = scope.order(id: :desc).to_a + accounts = scope.order(id: :desc).includes(:account_stat, :user).to_a say "Multiple local accounts were found for username '#{accounts.first.username}'.", :yellow say 'All those accounts are distinct accounts but only the most recently-created one is fully-functional.', :yellow From 78ee1453f99bbdd1411349ac5b84833ff7b9e6cb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 23 Jan 2024 11:11:37 +0100 Subject: [PATCH 5/9] New Crowdin Translations (automated) (#28857) Co-authored-by: GitHub Actions --- app/javascript/mastodon/locales/ca.json | 4 ++-- app/javascript/mastodon/locales/pt-BR.json | 2 ++ config/locales/bg.yml | 5 +++++ config/locales/ca.yml | 15 ++++++++++++--- config/locales/de.yml | 8 +++++++- config/locales/devise.ca.yml | 8 ++++---- config/locales/es-AR.yml | 6 ++++++ config/locales/es-MX.yml | 2 ++ config/locales/es.yml | 2 ++ config/locales/et.yml | 7 +++++++ config/locales/eu.yml | 6 ++++++ config/locales/fi.yml | 6 ++++++ config/locales/fo.yml | 6 ++++++ config/locales/fy.yml | 1 + config/locales/he.yml | 6 ++++++ config/locales/hu.yml | 6 ++++++ config/locales/is.yml | 6 ++++++ config/locales/it.yml | 6 ++++++ config/locales/ko.yml | 2 ++ config/locales/lad.yml | 2 ++ config/locales/lt.yml | 7 +++++++ config/locales/nl.yml | 5 +++++ config/locales/nn.yml | 6 ++++++ config/locales/no.yml | 6 ++++++ config/locales/pl.yml | 6 ++++++ config/locales/pt-BR.yml | 7 +++++++ config/locales/pt-PT.yml | 6 ++++++ config/locales/sr-Latn.yml | 6 ++++++ config/locales/sr.yml | 6 ++++++ config/locales/sv.yml | 3 +++ config/locales/tr.yml | 6 ++++++ config/locales/zh-CN.yml | 6 ++++++ config/locales/zh-HK.yml | 6 ++++++ config/locales/zh-TW.yml | 6 ++++++ 34 files changed, 178 insertions(+), 10 deletions(-) diff --git a/app/javascript/mastodon/locales/ca.json b/app/javascript/mastodon/locales/ca.json index 290b364a52..7d1049a30f 100644 --- a/app/javascript/mastodon/locales/ca.json +++ b/app/javascript/mastodon/locales/ca.json @@ -150,7 +150,7 @@ "compose_form.poll.duration": "Durada de l'enquesta", "compose_form.poll.option_placeholder": "Opció {number}", "compose_form.poll.remove_option": "Elimina aquesta opció", - "compose_form.poll.switch_to_multiple": "Canvia l’enquesta per a permetre diverses opcions", + "compose_form.poll.switch_to_multiple": "Canvia l’enquesta per a permetre múltiples opcions", "compose_form.poll.switch_to_single": "Canvia l’enquesta per a permetre una única opció", "compose_form.publish": "Tut", "compose_form.publish_form": "Nou tut", @@ -607,7 +607,7 @@ "search.quick_action.status_search": "Tuts coincidint amb {x}", "search.search_or_paste": "Cerca o escriu l'URL", "search_popout.full_text_search_disabled_message": "No disponible a {domain}.", - "search_popout.full_text_search_logged_out_message": "Només disponible en iniciar la sessió.", + "search_popout.full_text_search_logged_out_message": "Només disponible amb la sessió iniciada.", "search_popout.language_code": "Codi de llengua ISO", "search_popout.options": "Opcions de cerca", "search_popout.quick_actions": "Accions ràpides", diff --git a/app/javascript/mastodon/locales/pt-BR.json b/app/javascript/mastodon/locales/pt-BR.json index 482cc8ee73..b8e18e1229 100644 --- a/app/javascript/mastodon/locales/pt-BR.json +++ b/app/javascript/mastodon/locales/pt-BR.json @@ -32,6 +32,7 @@ "account.featured_tags.last_status_never": "Sem publicações", "account.featured_tags.title": "Hashtags em destaque de {name}", "account.follow": "Seguir", + "account.follow_back": "Seguir de volta", "account.followers": "Seguidores", "account.followers.empty": "Nada aqui.", "account.followers_counter": "{count, plural, one {{counter} seguidor} other {{counter} seguidores}}", @@ -52,6 +53,7 @@ "account.mute_notifications_short": "Silenciar notificações", "account.mute_short": "Silenciar", "account.muted": "Silenciado", + "account.mutual": "Mútuo", "account.no_bio": "Nenhuma descrição fornecida.", "account.open_original_page": "Abrir a página original", "account.posts": "Toots", diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 58a5cae2fd..c3eaa7e4c2 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -1790,6 +1790,11 @@ bg: extra: Вече е готово за теглене! subject: Вашият архив е готов за изтегляне title: Сваляне на архива + failed_2fa: + details: 'Ето подробности на опита за влизане:' + explanation: Някой се опита да влезе в акаунта ви, но предостави невалиден втори фактор за удостоверяване. + subject: Неуспешен втори фактор за удостоверяване + title: Провал на втория фактор за удостоверяване suspicious_sign_in: change_password: промяна на паролата ви details: 'Ето подробности при вход:' diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 36ebb9785b..38ef976b83 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -425,7 +425,7 @@ ca: view: Veure el bloqueig del domini email_domain_blocks: add_new: Afegir nou - allow_registrations_with_approval: Registre permès amb validació + allow_registrations_with_approval: Permet els registres amb validació attempts_over_week: one: "%{count} intent en la darrera setmana" other: "%{count} intents de registre en la darrera setmana" @@ -1046,6 +1046,7 @@ ca: clicking_this_link: en clicar aquest enllaç login_link: inici de sessió proceed_to_login_html: Ara pots passar a %{login_link}. + redirect_to_app_html: Se us hauria d'haver redirigit a l'app %{app_name}. Si això no ha passat, intenteu %{clicking_this_link} o torneu manualment a l'app. registration_complete: La teva inscripció a %{domain} ja és completa. welcome_title: Hola, %{name}! wrong_email_hint: Si aquesta adreça de correu electrònic no és correcte, pots canviar-la en els ajustos del compte. @@ -1109,6 +1110,7 @@ ca: functional: El teu compte està completament operatiu. pending: La vostra sol·licitud està pendent de revisió pel nostre personal. Això pot trigar una mica. Rebreu un correu electrònic quan sigui aprovada. redirecting_to: El teu compte és inactiu perquè actualment està redirigint a %{acct}. + self_destruct: Com que %{domain} tanca, només tindreu accés limitat al vostre compte. view_strikes: Veure accions del passat contra el teu compte too_fast: Formulari enviat massa ràpid, torna a provar-ho. use_security_key: Usa clau de seguretat @@ -1580,6 +1582,7 @@ ca: over_total_limit: Has superat el límit de %{limit} tuts programats too_soon: La data programada ha de ser futura self_destruct: + lead_html: Lamentablement, %{domain} tanca de forma definitiva. Si hi teníeu un compte, no el podreu continuar utilitzant, però podeu demanar una còpia de les vostres dades. title: Aquest servidor tancarà sessions: activity: Última activitat @@ -1784,9 +1787,15 @@ ca: title: Apel·lació rebutjada backup_ready: explanation: Heu demanat una còpia completa de les dades del vostre compte de Mastodon. - extra: Ja us ho podeu baixar + extra: Ja la podeu baixar subject: L'arxiu està preparat per a descàrrega title: Recollida de l'arxiu + failed_2fa: + details: 'Aquests són els detalls de l''intent d''accés:' + explanation: Algú ha intentat accedir al vostre compte però no ha proporcionat un factor de doble autenticació correcte. + further_actions_html: Si no heu estat vosaltres, us recomanem que %{action} immediatament perquè pot estar compromès. + subject: Ha fallat el factor de doble autenticació + title: Ha fallat l'autenticació de doble factor suspicious_sign_in: change_password: canvia la teva contrasenya details: 'Aquest són els detalls de l''inici de sessió:' @@ -1840,7 +1849,7 @@ ca: go_to_sso_account_settings: Ves a la configuració del compte del teu proveïdor d'identitat invalid_otp_token: El codi de dos factors no és correcte otp_lost_help_html: Si has perdut l'accés a tots dos pots contactar per %{email} - rate_limited: Excessius intents d'autenticació, torneu-ho a provar més tard. + rate_limited: Excessius intents d'autenticació, torneu-hi més tard. seamless_external_login: Has iniciat sessió via un servei extern per tant els ajustos de contrasenya i correu electrònic no estan disponibles. signed_in_as: 'Sessió iniciada com a:' verification: diff --git a/config/locales/de.yml b/config/locales/de.yml index e177c6d2d1..9568f698d1 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1790,8 +1790,14 @@ de: extra: Sie ist jetzt zum Herunterladen bereit! subject: Dein persönliches Archiv kann heruntergeladen werden title: Archiv-Download + failed_2fa: + details: 'Details zum Anmeldeversuch:' + explanation: Jemand hat versucht, sich bei deinem Konto anzumelden, aber die Zwei-Faktor-Authentisierung schlug fehl. + further_actions_html: Solltest du das nicht gewesen sein, empfehlen wir dir, sofort %{action}, da dein Konto möglicherweise kompromittiert ist. + subject: Zwei-Faktor-Authentisierung fehlgeschlagen + title: Zwei-Faktor-Authentisierung fehlgeschlagen suspicious_sign_in: - change_password: dein Passwort ändern + change_password: dein Passwort zu ändern details: 'Hier sind die Details zu den Anmeldeversuchen:' explanation: Wir haben eine Anmeldung zu deinem Konto von einer neuen IP-Adresse festgestellt. further_actions_html: Wenn du das nicht warst, empfehlen wir dir schnellstmöglich, %{action} und die Zwei-Faktor-Authentisierung (2FA) für dein Konto zu aktivieren, um es abzusichern. diff --git a/config/locales/devise.ca.yml b/config/locales/devise.ca.yml index 2bf741ee40..3720d3c5f7 100644 --- a/config/locales/devise.ca.yml +++ b/config/locales/devise.ca.yml @@ -49,19 +49,19 @@ ca: subject: 'Mastodon: Instruccions per a reiniciar contrasenya' title: Contrasenya restablerta two_factor_disabled: - explanation: Només es pot accedir amb compte de correu i contrasenya. + explanation: Ara es pot accedir amb només compte de correu i contrasenya. subject: 'Mastodon: Autenticació de doble factor desactivada' subtitle: S'ha deshabilitat l'autenticació de doble factor al vostre compte. title: A2F desactivada two_factor_enabled: - explanation: Per accedir fa falta un token generat per l'aplicació TOTP aparellada. + explanation: Per accedir cal un token generat per l'aplicació TOTP aparellada. subject: 'Mastodon: Autenticació de doble factor activada' subtitle: S'ha habilitat l'autenticació de doble factor al vostre compte. title: A2F activada two_factor_recovery_codes_changed: explanation: Els codis de recuperació anteriors ja no són vàlids i se n'han generat de nous. subject: 'Mastodon: codis de recuperació de doble factor regenerats' - subtitle: S'han invalidat els codis de recuperació anteriors i se n'ha generat de nous. + subtitle: S'han invalidat els codis de recuperació anteriors i se n'han generat de nous. title: Codis de recuperació A2F canviats unlock_instructions: subject: 'Mastodon: Instruccions per a desblocar' @@ -76,7 +76,7 @@ ca: title: Una de les teves claus de seguretat ha estat esborrada webauthn_disabled: explanation: S'ha deshabilitat l'autenticació amb claus de seguretat al vostre compte. - extra: Ara només podeu accedir amb el token generat amb l'aplicació TOTP aparellada. + extra: Ara es pot accedir amb només el token generat amb l'aplicació TOTP aparellada. subject: 'Mastodon: S''ha desactivat l''autenticació amb claus de seguretat' title: Claus de seguretat desactivades webauthn_enabled: diff --git a/config/locales/es-AR.yml b/config/locales/es-AR.yml index 0b6e58db59..cc55d3d3ff 100644 --- a/config/locales/es-AR.yml +++ b/config/locales/es-AR.yml @@ -1790,6 +1790,12 @@ es-AR: extra: "¡Ya está lista para descargar!" subject: Tu archivo historial está listo para descargar title: Descargar archivo historial + failed_2fa: + details: 'Estos son los detalles del intento de inicio de sesión:' + explanation: Alguien intentó iniciar sesión en tu cuenta pero proporcionó un segundo factor de autenticación no válido. + further_actions_html: Si vos no fuiste, te recomendamos que %{action} inmediatamente, ya que la seguridad de tu cuenta podría estar comprometida. + subject: Fallo de autenticación del segundo factor + title: Fallo en la autenticación del segundo factor suspicious_sign_in: change_password: cambiés tu contraseña details: 'Acá están los detalles del inicio de sesión:' diff --git a/config/locales/es-MX.yml b/config/locales/es-MX.yml index 11c327bcca..040d8a9d3c 100644 --- a/config/locales/es-MX.yml +++ b/config/locales/es-MX.yml @@ -1790,6 +1790,8 @@ es-MX: extra: "¡Ya está listo para descargar!" subject: Tu archivo está preparado para descargar title: Descargar archivo + failed_2fa: + details: 'Estos son los detalles del intento de inicio de sesión:' suspicious_sign_in: change_password: cambies tu contraseña details: 'Aquí están los detalles del inicio de sesión:' diff --git a/config/locales/es.yml b/config/locales/es.yml index 4dbb76c526..ffe3eb5b00 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -1790,6 +1790,8 @@ es: extra: "¡Ya está listo para descargar!" subject: Tu archivo está preparado para descargar title: Descargar archivo + failed_2fa: + details: 'Estos son los detalles del intento de inicio de sesión:' suspicious_sign_in: change_password: cambies tu contraseña details: 'Aquí están los detalles del inicio de sesión:' diff --git a/config/locales/et.yml b/config/locales/et.yml index 71f49e1abb..f82ee6cb8f 100644 --- a/config/locales/et.yml +++ b/config/locales/et.yml @@ -1792,6 +1792,12 @@ et: extra: See on nüüd allalaadimiseks valmis! subject: Arhiiv on allalaadimiseks valmis title: Arhiivi väljavõte + failed_2fa: + details: 'Sisenemise üksikasjad:' + explanation: Keegi püüdis Su kontole siseneda, ent sisestas vale teisese autentimisfaktori. + further_actions_html: Kui see polnud Sina, siis soovitame viivitamata %{action}, kuna see võib olla lekkinud. + subject: Kaheastmelise autentimise nurjumine + title: Kaheastmeline autentimine nurjus suspicious_sign_in: change_password: muuta oma salasõna details: 'Sisenemise üksikasjad:' @@ -1848,6 +1854,7 @@ et: go_to_sso_account_settings: Mine oma idenditeedipakkuja kontosätetesse invalid_otp_token: Vale kaheastmeline võti otp_lost_help_html: Kui kaotasid ligipääsu mõlemale, saad võtta ühendust %{email}-iga + rate_limited: Liiga palju autentimise katseid, proovi hiljem uuesti. seamless_external_login: Välise teenuse kaudu sisse logides pole salasõna ja e-posti sätted saadaval. signed_in_as: 'Sisse logitud kasutajana:' verification: diff --git a/config/locales/eu.yml b/config/locales/eu.yml index bfa1f829b6..bd6ea8c832 100644 --- a/config/locales/eu.yml +++ b/config/locales/eu.yml @@ -1794,6 +1794,12 @@ eu: extra: Deskargatzeko prest! subject: Zure artxiboa deskargatzeko prest dago title: Artxiboa jasotzea + failed_2fa: + details: 'Hemen dituzu saio-hasieraren saiakeraren xehetasunak:' + explanation: Norbait zure kontuan saioa hasten saiatu da, baina bigarren autentifikazioaren faktore baliogabea eman du. + further_actions_html: Ez bazara zu izan, "%{action}" ekintza berehala egitea gomendatzen dugu, kontua arriskarazi daiteke eta. + subject: Autentifikazioaren bigarren faktoreak huts egin du + title: Huts egin duen autentifikazioaren bigarren faktorea suspicious_sign_in: change_password: aldatu pasahitza details: 'Hemen daude saio hasieraren xehetasunak:' diff --git a/config/locales/fi.yml b/config/locales/fi.yml index 9d8974392f..8e61c7b2a0 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -1790,6 +1790,12 @@ fi: extra: Se on nyt valmis ladattavaksi! subject: Arkisto on valmiina ladattavaksi title: Arkiston tallennus + failed_2fa: + details: 'Tässä on tiedot kirjautumisyrityksestä:' + explanation: Joku on yrittänyt kirjautua tilillesi, mutta antanut virheellisen kaksivaiheisen todennuksen. + further_actions_html: Jos se et ollut sinä, suosittelemme, että %{action} välittömästi, sillä se on saattanut vaarantua. + subject: Kaksivaiheisen todennuksen virhe + title: Epäonnistunut kaksivaiheinen todennus suspicious_sign_in: change_password: vaihda salasanasi details: 'Tässä on tiedot kirjautumisesta:' diff --git a/config/locales/fo.yml b/config/locales/fo.yml index dabaf24ba7..8e34265313 100644 --- a/config/locales/fo.yml +++ b/config/locales/fo.yml @@ -1790,6 +1790,12 @@ fo: extra: Tað er nú klárt at taka niður! subject: Savnið hjá tær er tøkt at taka niður title: Tak savn niður + failed_2fa: + details: 'Her eru smálutirnir í innritanarroyndini:' + explanation: Onkur hevur roynt at rita inn á tína kontu, men gav eitt ógildugt seinna samgildi. + further_actions_html: Um hetta ikki var tú, so skjóta vit upp, at tú %{action} beinan vegin, tí tað kann vera sett í vanda. + subject: Seinna samgildi miseydnaðist + title: Miseydnað seinna samgildi suspicious_sign_in: change_password: broyt loyniorðið hjá tær details: 'Her eru smálutirnir í innritanini:' diff --git a/config/locales/fy.yml b/config/locales/fy.yml index 1d648f4790..f861bc3e4a 100644 --- a/config/locales/fy.yml +++ b/config/locales/fy.yml @@ -1843,6 +1843,7 @@ fy: go_to_sso_account_settings: Gean nei de accountynstellingen fan jo identiteitsprovider invalid_otp_token: Unjildige twa-stapstagongskoade otp_lost_help_html: As jo tagong ta beide kwytrekke binne, nim dan kontakt op fia %{email} + rate_limited: Te folle autentikaasjebesykjen, probearje it letter opnij. seamless_external_login: Jo binne oanmeld fia in eksterne tsjinst, dêrom binne wachtwurden en e-mailynstellingen net beskikber. signed_in_as: 'Oanmeld as:' verification: diff --git a/config/locales/he.yml b/config/locales/he.yml index db57912d89..1f5fd096ac 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -1854,6 +1854,12 @@ he: extra: הגיבוי מוכן להורדה! subject: הארכיון שלך מוכן להורדה title: הוצאת ארכיון + failed_2fa: + details: 'הנה פרטי נסיון ההתחברות:' + explanation: פולני אלמוני ניסה להתחבר לחשבונך אך האימות המשני נכשל. + further_actions_html: אם הנסיון לא היה שלך, אנו ממליצים על %{action} באופן מיידי כדי שהחשבון לא יפול קורבן. + subject: נכשל אימות בגורם שני + title: אימות בגורם שני נכשל suspicious_sign_in: change_password: שינוי הסיסמא שלך details: 'הנה פרטי ההתחברות:' diff --git a/config/locales/hu.yml b/config/locales/hu.yml index 8fce206e9e..2870435ea7 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -1790,6 +1790,12 @@ hu: extra: Már letöltésre kész! subject: Az adataidról készült archív letöltésre kész title: Archiválás + failed_2fa: + details: 'Itt vannak a bejelentkezési kísérlet részletei:' + explanation: Valaki megpróbált bejelentkezni a fiókodba, de a második hitelesítési lépése érvénytelen volt. + further_actions_html: Ha ez nem te voltál, azt javasoljuk, hogy azonnal %{action}, mivel lehetséges, hogy az rossz kezekbe került. + subject: Második körös hitelesítés sikertelen + title: Sikertelen a második körös hitelesítés suspicious_sign_in: change_password: módosítsd a jelszavad details: 'Itt vannak a bejelentkezés részletei:' diff --git a/config/locales/is.yml b/config/locales/is.yml index b048d5cb00..191383f56c 100644 --- a/config/locales/is.yml +++ b/config/locales/is.yml @@ -1794,6 +1794,12 @@ is: extra: Það er núna tilbúið til niðurhals! subject: Safnskráin þín er tilbúin til niðurhals title: Taka út í safnskrá + failed_2fa: + details: 'Hér eru nánari upplýsingar um innskráningartilraunina:' + explanation: Einhver reyndi að skrá sig inn á aðganginn þinn en gaf upp ógild gögn seinna þrepi auðkenningar. + further_actions_html: Ef þetta varst ekki þú, þá mælum við eindregið með því að þú %{action} samstundis, þar sem það gæti verið berskjaldað. + subject: Bilun í seinna þrepi auðkenningar + title: Seinna þrep auðkenningar brást suspicious_sign_in: change_password: breytir lykilorðinu þínu details: 'Hér eru nánari upplýsingar um innskráninguna:' diff --git a/config/locales/it.yml b/config/locales/it.yml index adcef9559f..89ff071f36 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -1792,6 +1792,12 @@ it: extra: Ora è pronto per il download! subject: Il tuo archivio è pronto per essere scaricato title: Esportazione archivio + failed_2fa: + details: 'Questi sono i dettagli del tentativo di accesso:' + explanation: Qualcuno ha tentato di accedere al tuo account ma ha fornito un secondo fattore di autenticazione non valido. + further_actions_html: Se non eri tu, ti consigliamo di %{action} immediatamente poiché potrebbe essere compromesso. + subject: Errore di autenticazione del secondo fattore + title: Autenticazione del secondo fattore non riuscita suspicious_sign_in: change_password: cambiare la tua password details: 'Questi sono i dettagli del tentativo di accesso:' diff --git a/config/locales/ko.yml b/config/locales/ko.yml index 946aa35657..b3c786e265 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -1760,6 +1760,8 @@ ko: extra: 다운로드 할 준비가 되었습니다! subject: 아카이브를 다운로드할 수 있습니다 title: 아카이브 테이크아웃 + failed_2fa: + details: '로그인 시도에 대한 상세 정보입니다:' suspicious_sign_in: change_password: 암호 변경 details: '로그인에 대한 상세 정보입니다:' diff --git a/config/locales/lad.yml b/config/locales/lad.yml index 5a09c4c609..be5d2d21bd 100644 --- a/config/locales/lad.yml +++ b/config/locales/lad.yml @@ -1757,6 +1757,8 @@ lad: extra: Agora esta pronto para abashar! subject: Tu dosya esta pronta para abashar title: Abasha dosya + failed_2fa: + details: 'Aki estan los peratim de las provas de koneksyon kon tu kuento:' suspicious_sign_in: change_password: troka tu kod details: 'Aki estan los peratim de la koneksyon kon tu kuento:' diff --git a/config/locales/lt.yml b/config/locales/lt.yml index f3715fd2ee..ba8b53fdc9 100644 --- a/config/locales/lt.yml +++ b/config/locales/lt.yml @@ -559,6 +559,12 @@ lt: extra: Jį jau galima atsisiųsti! subject: Jūsų archyvas paruoštas parsisiuntimui title: Archyvas išimtas + failed_2fa: + details: 'Štai išsami informacija apie bandymą prisijungti:' + explanation: Kažkas bandė prisijungti prie tavo paskyros, bet nurodė netinkamą antrąjį tapatybės nustatymo veiksnį. + further_actions_html: Jei tai buvo ne tu, rekomenduojame nedelsiant imtis %{action}, nes jis gali būti pažeistas. + subject: Antrojo veiksnio tapatybės nustatymas nesėkmingai + title: Nepavyko atlikti antrojo veiksnio tapatybės nustatymo warning: subject: disable: Jūsų paskyra %{acct} buvo užšaldyta @@ -584,6 +590,7 @@ lt: go_to_sso_account_settings: Eik į savo tapatybės teikėjo paskyros nustatymus invalid_otp_token: Netinkamas dviejų veiksnių kodas otp_lost_help_html: Jei praradai prieigą prie abiejų, gali susisiek su %{email} + rate_limited: Per daug tapatybės nustatymo bandymų. Bandyk dar kartą vėliau. seamless_external_login: Esi prisijungęs (-usi) per išorinę paslaugą, todėl slaptažodžio ir el. pašto nustatymai nepasiekiami. signed_in_as: 'Prisijungta kaip:' verification: diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 5ffa788a8c..2d27f9165d 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -1790,6 +1790,11 @@ nl: extra: Het staat nu klaar om te worden gedownload! subject: Jouw archief staat klaar om te worden gedownload title: Archief ophalen + failed_2fa: + details: 'Hier zijn details van de aanmeldpoging:' + explanation: Iemand heeft geprobeerd om in te loggen op uw account maar heeft een ongeldige tweede verificatiefactor opgegeven. + subject: Tweede factor authenticatiefout + title: Tweestapsverificatie mislukt suspicious_sign_in: change_password: je wachtwoord te wijzigen details: 'Hier zijn de details van inlogpoging:' diff --git a/config/locales/nn.yml b/config/locales/nn.yml index 626252be00..95eed49785 100644 --- a/config/locales/nn.yml +++ b/config/locales/nn.yml @@ -1790,6 +1790,12 @@ nn: extra: Den er nå klar for nedlasting! subject: Arkivet ditt er klart til å lastes ned title: Nedlasting av arkiv + failed_2fa: + details: 'Her er detaljane om innloggingsforsøket:' + explanation: Nokon har prøvd å logge inn på kontoen din, men brukte ein ugyldig andre-autentiseringsfaktor. + further_actions_html: Om dette ikkje var deg, rår me deg til å %{action} med éin gong, då det kan vere kompomittert. + subject: To-faktor-autentiseringsfeil + title: Mislukka to-faktor-autentisering suspicious_sign_in: change_password: endre passord details: 'Her er påloggingsdetaljane:' diff --git a/config/locales/no.yml b/config/locales/no.yml index d90aa5bab5..7ece8564fc 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -1790,6 +1790,12 @@ extra: Den er nå klar for nedlasting! subject: Arkivet ditt er klart til å lastes ned title: Nedlasting av arkiv + failed_2fa: + details: 'Her er detaljer om påloggingsforsøket:' + explanation: Noen har prøvd å logge på kontoen din, men ga en ugyldig andre-autentiseringsfaktor. + further_actions_html: Hvis dette ikke var deg, anbefaler vi at du %{action} umiddelbart fordi det kan ha blitt kompromittert. + subject: Andre-autentiseringsfaktorfeil + title: Mislykket andre-autentiseringsfaktor suspicious_sign_in: change_password: endre passord details: 'Her er detaljer om påloggingen:' diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 4d8fde8f4f..6718f1994b 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -1854,6 +1854,12 @@ pl: extra: Gotowe do pobrania! subject: Twoje archiwum jest gotowe do pobrania title: Odbiór archiwum + failed_2fa: + details: 'Oto szczegóły próby logowania:' + explanation: Ktoś próbował zalogować się na twoje konto, ale nie przeszedł drugiego etapu autoryzacji. + further_actions_html: Jeśli to nie ty, polecamy natychmiastowo %{action}, bo może ono być narażone. + subject: Błąd drugiego etapu uwierzytelniania + title: Nieudane uwierzytelnienie w drugim etapie suspicious_sign_in: change_password: zmień hasło details: 'Oto szczegóły logowania:' diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 47ad0ac448..c1a47c0161 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -1789,6 +1789,12 @@ pt-BR: extra: Agora está pronto para baixar! subject: Seu arquivo está pronto para ser baixado title: Baixar arquivo + failed_2fa: + details: 'Aqui estão os detalhes da tentativa de acesso:' + explanation: Alguém tentou entrar em sua conta, mas forneceu um segundo fator de autenticação inválido. + further_actions_html: Se não foi você, recomendamos que %{action} imediatamente, pois ela pode ser comprometida. + subject: Falha na autenticação do segundo fator + title: Falha na autenticação do segundo fator suspicious_sign_in: change_password: Altere sua senha details: 'Aqui estão os detalhes do acesso:' @@ -1842,6 +1848,7 @@ pt-BR: go_to_sso_account_settings: Vá para as configurações de conta do seu provedor de identidade invalid_otp_token: Código de dois fatores inválido otp_lost_help_html: Se você perder o acesso à ambos, você pode entrar em contato com %{email} + rate_limited: Muitas tentativas de autenticação; tente novamente mais tarde. seamless_external_login: Você entrou usando um serviço externo, então configurações de e-mail e senha não estão disponíveis. signed_in_as: 'Entrou como:' verification: diff --git a/config/locales/pt-PT.yml b/config/locales/pt-PT.yml index 2e077b37a8..268531718d 100644 --- a/config/locales/pt-PT.yml +++ b/config/locales/pt-PT.yml @@ -1790,6 +1790,12 @@ pt-PT: extra: Está pronta para transferir! subject: O seu arquivo está pronto para descarregar title: Arquivo de ficheiros + failed_2fa: + details: 'Aqui estão os detalhes da tentativa de entrada:' + explanation: Alguém tentou entrar em sua conta mas forneceu um segundo fator de autenticação inválido. + further_actions_html: Se não foi você, recomendamos que %{action} imediatamente, pois pode ter sido comprometido. + subject: Falha na autenticação do segundo fator + title: Falha na autenticação do segundo fator suspicious_sign_in: change_password: alterar a sua palavra-passe details: 'Eis os pormenores do início de sessão:' diff --git a/config/locales/sr-Latn.yml b/config/locales/sr-Latn.yml index 39c9f2f873..9cb555c943 100644 --- a/config/locales/sr-Latn.yml +++ b/config/locales/sr-Latn.yml @@ -1822,6 +1822,12 @@ sr-Latn: extra: Sada je spremno za preuzimanje! subject: Vaša arhiva je spremna za preuzimanje title: Izvoz arhive + failed_2fa: + details: 'Evo detalja o pokušaju prijavljivanja:' + explanation: Neko je pokušao da se prijavi na vaš nalog ali je dao nevažeći drugi faktor autentifikacije. + further_actions_html: Ako to niste bili vi, preporučujemo vam da odmah %{action} jer može biti ugrožena. + subject: Neuspeh drugog faktora autentifikacije + title: Nije uspeo drugi faktor autentifikacije suspicious_sign_in: change_password: promenite svoju lozinku details: 'Evo detalja o prijavi:' diff --git a/config/locales/sr.yml b/config/locales/sr.yml index 0cf35c14cc..e1c2e992ed 100644 --- a/config/locales/sr.yml +++ b/config/locales/sr.yml @@ -1822,6 +1822,12 @@ sr: extra: Сада је спремно за преузимање! subject: Ваша архива је спремна за преузимање title: Извоз архиве + failed_2fa: + details: 'Ево детаља о покушају пријављивања:' + explanation: Неко је покушао да се пријави на ваш налог али је дао неважећи други фактор аутентификације. + further_actions_html: Ако то нисте били ви, препоручујемо вам да одмах %{action} јер може бити угрожена. + subject: Неуспех другог фактора аутентификације + title: Није успео други фактор аутентификације suspicious_sign_in: change_password: промените своју лозинку details: 'Ево детаља о пријави:' diff --git a/config/locales/sv.yml b/config/locales/sv.yml index 3a82f29d2f..c9000d50fc 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -1789,6 +1789,9 @@ sv: extra: Nu redo för nedladdning! subject: Ditt arkiv är klart för nedladdning title: Arkivuttagning + failed_2fa: + further_actions_html: Om detta inte var du, rekommenderar vi att du %{action} omedelbart eftersom ditt konto kan ha äventyrats. + title: Misslyckad tvåfaktorsautentisering suspicious_sign_in: change_password: Ändra ditt lösenord details: 'Här är inloggningsdetaljerna:' diff --git a/config/locales/tr.yml b/config/locales/tr.yml index 3b74c4eaa1..fa84d2a96d 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -1790,6 +1790,12 @@ tr: extra: Şimdi indirebilirsiniz! subject: Arşiviniz indirilmeye hazır title: Arşiv paketlemesi + failed_2fa: + details: 'Oturum açma denemesinin ayrıntıları şöyledir:' + explanation: Birisi hesabınızda oturum açmaya çalıştı ancak hatalı bir iki aşamalı doğrulama kodu kullandı. + further_actions_html: Eğer bu kişi siz değilseniz, hemen %{action} yapmanızı öneriyoruz çünkü hesabınız ifşa olmuş olabilir. + subject: İki aşamalı doğrulama başarısızlığı + title: Başarısız iki aşamalı kimlik doğrulama suspicious_sign_in: change_password: parolanızı değiştirin details: 'Oturum açma ayrıntıları şöyledir:' diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index 80bb5653ca..272787ce25 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -1758,6 +1758,12 @@ zh-CN: extra: 现在它可以下载了! subject: 你的存档已经准备完毕 title: 存档导出 + failed_2fa: + details: 以下是该次登录尝试的详情: + explanation: 有人试图登录到您的账户,但提供了无效的辅助认证因子。 + further_actions_html: 如果这不是您所为,您的密码可能已经泄露,建议您立即 %{action} 。 + subject: 辅助认证失败 + title: 辅助认证失败 suspicious_sign_in: change_password: 更改密码 details: 以下是该次登录的详细信息: diff --git a/config/locales/zh-HK.yml b/config/locales/zh-HK.yml index ac32c03e95..0c39aa8c0b 100644 --- a/config/locales/zh-HK.yml +++ b/config/locales/zh-HK.yml @@ -1758,6 +1758,12 @@ zh-HK: extra: 現在可以下載了! subject: 你的備份檔已可供下載 title: 檔案匯出 + failed_2fa: + details: 以下是嘗試登入的細節: + explanation: 有人嘗試登入你的帳號,但沒有通過雙重認證。 + further_actions_html: 如果這不是你,我們建議你立刻%{action},因為你的帳號或已遭到侵害。 + subject: 雙重認證失敗 + title: 雙重認證失敗 suspicious_sign_in: change_password: 更改你的密碼 details: 以下是登入的細節: diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 6662e44cdc..8726ea72a4 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -1760,6 +1760,12 @@ zh-TW: extra: 準備好下載了! subject: 您的備份檔已可供下載 title: 檔案匯出 + failed_2fa: + details: 以下是該登入嘗試之詳細資訊: + explanation: 有人嘗試登入您的帳號,但提供了無效的第二個驗證因子。 + further_actions_html: 若這並非您所為,我們建議您立刻 %{action},因為其可能已被入侵。 + subject: 第二因子驗證失敗 + title: 第二因子身份驗證失敗 suspicious_sign_in: change_password: 變更密碼 details: 以下是該登入之詳細資訊: From ceade78182e882f3a045d4c6c748743bfc0b8f5e Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 23 Jan 2024 06:41:34 -0500 Subject: [PATCH 6/9] Fix `Rails/WhereExists` cop in app/services (#28853) --- .rubocop_todo.yml | 2 -- app/services/activitypub/fetch_remote_status_service.rb | 2 +- app/services/vote_service.rb | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index c0fb7a5ce2..bef79e451a 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -86,8 +86,6 @@ Rails/WhereExists: - 'app/models/status.rb' - 'app/policies/status_policy.rb' - 'app/serializers/rest/announcement_serializer.rb' - - 'app/services/activitypub/fetch_remote_status_service.rb' - - 'app/services/vote_service.rb' - 'app/workers/move_worker.rb' - 'spec/models/account_spec.rb' - 'spec/services/activitypub/process_collection_service_spec.rb' diff --git a/app/services/activitypub/fetch_remote_status_service.rb b/app/services/activitypub/fetch_remote_status_service.rb index a491b32b26..e3a9b60b56 100644 --- a/app/services/activitypub/fetch_remote_status_service.rb +++ b/app/services/activitypub/fetch_remote_status_service.rb @@ -44,7 +44,7 @@ class ActivityPub::FetchRemoteStatusService < BaseService # If we fetched a status that already exists, then we need to treat the # activity as an update rather than create - activity_json['type'] = 'Update' if equals_or_includes_any?(activity_json['type'], %w(Create)) && Status.where(uri: object_uri, account_id: actor.id).exists? + activity_json['type'] = 'Update' if equals_or_includes_any?(activity_json['type'], %w(Create)) && Status.exists?(uri: object_uri, account_id: actor.id) with_redis do |redis| discoveries = redis.incr("status_discovery_per_request:#{@request_id}") diff --git a/app/services/vote_service.rb b/app/services/vote_service.rb index 3e92a1690a..878350388b 100644 --- a/app/services/vote_service.rb +++ b/app/services/vote_service.rb @@ -19,7 +19,7 @@ class VoteService < BaseService already_voted = true with_redis_lock("vote:#{@poll.id}:#{@account.id}") do - already_voted = @poll.votes.where(account: @account).exists? + already_voted = @poll.votes.exists?(account: @account) ApplicationRecord.transaction do @choices.each do |choice| From c0e8e457abee9d6f6dd20338bdaac90cb9e1f7bc Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 23 Jan 2024 06:41:54 -0500 Subject: [PATCH 7/9] Eager loading fixes for `api/` controllers (#28848) --- .../api/v1/accounts/follower_accounts_controller.rb | 2 +- .../api/v1/accounts/following_accounts_controller.rb | 2 +- app/controllers/api/v1/blocks_controller.rb | 2 +- app/controllers/api/v1/directories_controller.rb | 2 +- app/controllers/api/v1/endorsements_controller.rb | 2 +- app/controllers/api/v1/follow_requests_controller.rb | 2 +- app/controllers/api/v1/lists/accounts_controller.rb | 4 ++-- app/controllers/api/v1/mutes_controller.rb | 2 +- .../api/v1/statuses/favourited_by_accounts_controller.rb | 2 +- .../api/v1/statuses/reblogged_by_accounts_controller.rb | 2 +- app/controllers/api/v2/filters_controller.rb | 2 +- app/models/account_suggestions.rb | 2 +- app/models/report.rb | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/controllers/api/v1/accounts/follower_accounts_controller.rb b/app/controllers/api/v1/accounts/follower_accounts_controller.rb index d6a5a7176d..f60181f1eb 100644 --- a/app/controllers/api/v1/accounts/follower_accounts_controller.rb +++ b/app/controllers/api/v1/accounts/follower_accounts_controller.rb @@ -30,7 +30,7 @@ class Api::V1::Accounts::FollowerAccountsController < Api::BaseController end def default_accounts - Account.includes(:active_relationships, :account_stat).references(:active_relationships) + Account.includes(:active_relationships, :account_stat, :user).references(:active_relationships) end def paginated_follows diff --git a/app/controllers/api/v1/accounts/following_accounts_controller.rb b/app/controllers/api/v1/accounts/following_accounts_controller.rb index b8578ef539..3ab8c1efd6 100644 --- a/app/controllers/api/v1/accounts/following_accounts_controller.rb +++ b/app/controllers/api/v1/accounts/following_accounts_controller.rb @@ -30,7 +30,7 @@ class Api::V1::Accounts::FollowingAccountsController < Api::BaseController end def default_accounts - Account.includes(:passive_relationships, :account_stat).references(:passive_relationships) + Account.includes(:passive_relationships, :account_stat, :user).references(:passive_relationships) end def paginated_follows diff --git a/app/controllers/api/v1/blocks_controller.rb b/app/controllers/api/v1/blocks_controller.rb index 06a8bfa891..0934622f88 100644 --- a/app/controllers/api/v1/blocks_controller.rb +++ b/app/controllers/api/v1/blocks_controller.rb @@ -17,7 +17,7 @@ class Api::V1::BlocksController < Api::BaseController end def paginated_blocks - @paginated_blocks ||= Block.eager_load(target_account: :account_stat) + @paginated_blocks ||= Block.eager_load(target_account: [:account_stat, :user]) .joins(:target_account) .merge(Account.without_suspended) .where(account: current_account) diff --git a/app/controllers/api/v1/directories_controller.rb b/app/controllers/api/v1/directories_controller.rb index e79b20ce42..6c540404ea 100644 --- a/app/controllers/api/v1/directories_controller.rb +++ b/app/controllers/api/v1/directories_controller.rb @@ -27,7 +27,7 @@ class Api::V1::DirectoriesController < Api::BaseController scope.merge!(local_account_scope) if local_accounts? scope.merge!(account_exclusion_scope) if current_account scope.merge!(account_domain_block_scope) if current_account && !local_accounts? - end + end.includes(:account_stat, user: :role) end def local_accounts? diff --git a/app/controllers/api/v1/endorsements_controller.rb b/app/controllers/api/v1/endorsements_controller.rb index 46e3fcd647..2216a9860d 100644 --- a/app/controllers/api/v1/endorsements_controller.rb +++ b/app/controllers/api/v1/endorsements_controller.rb @@ -25,7 +25,7 @@ class Api::V1::EndorsementsController < Api::BaseController end def endorsed_accounts - current_account.endorsed_accounts.includes(:account_stat).without_suspended + current_account.endorsed_accounts.includes(:account_stat, :user).without_suspended end def insert_pagination_headers diff --git a/app/controllers/api/v1/follow_requests_controller.rb b/app/controllers/api/v1/follow_requests_controller.rb index ee717ebbcc..87f6df5f94 100644 --- a/app/controllers/api/v1/follow_requests_controller.rb +++ b/app/controllers/api/v1/follow_requests_controller.rb @@ -37,7 +37,7 @@ class Api::V1::FollowRequestsController < Api::BaseController end def default_accounts - Account.without_suspended.includes(:follow_requests, :account_stat).references(:follow_requests) + Account.without_suspended.includes(:follow_requests, :account_stat, :user).references(:follow_requests) end def paginated_follow_requests diff --git a/app/controllers/api/v1/lists/accounts_controller.rb b/app/controllers/api/v1/lists/accounts_controller.rb index 8e12cb7b65..0604ad60fc 100644 --- a/app/controllers/api/v1/lists/accounts_controller.rb +++ b/app/controllers/api/v1/lists/accounts_controller.rb @@ -37,9 +37,9 @@ class Api::V1::Lists::AccountsController < Api::BaseController def load_accounts if unlimited? - @list.accounts.without_suspended.includes(:account_stat).all + @list.accounts.without_suspended.includes(:account_stat, :user).all else - @list.accounts.without_suspended.includes(:account_stat).paginate_by_max_id(limit_param(DEFAULT_ACCOUNTS_LIMIT), params[:max_id], params[:since_id]) + @list.accounts.without_suspended.includes(:account_stat, :user).paginate_by_max_id(limit_param(DEFAULT_ACCOUNTS_LIMIT), params[:max_id], params[:since_id]) end end diff --git a/app/controllers/api/v1/mutes_controller.rb b/app/controllers/api/v1/mutes_controller.rb index 555485823c..2fb685ac39 100644 --- a/app/controllers/api/v1/mutes_controller.rb +++ b/app/controllers/api/v1/mutes_controller.rb @@ -17,7 +17,7 @@ class Api::V1::MutesController < Api::BaseController end def paginated_mutes - @paginated_mutes ||= Mute.eager_load(:target_account) + @paginated_mutes ||= Mute.eager_load(target_account: [:account_stat, :user]) .joins(:target_account) .merge(Account.without_suspended) .where(account: current_account) diff --git a/app/controllers/api/v1/statuses/favourited_by_accounts_controller.rb b/app/controllers/api/v1/statuses/favourited_by_accounts_controller.rb index 98b69c347f..069ad37cb2 100644 --- a/app/controllers/api/v1/statuses/favourited_by_accounts_controller.rb +++ b/app/controllers/api/v1/statuses/favourited_by_accounts_controller.rb @@ -21,7 +21,7 @@ class Api::V1::Statuses::FavouritedByAccountsController < Api::V1::Statuses::Bas def default_accounts Account .without_suspended - .includes(:favourites, :account_stat) + .includes(:favourites, :account_stat, :user) .references(:favourites) .where(favourites: { status_id: @status.id }) end diff --git a/app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb b/app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb index aacab5f8f4..b8a997518d 100644 --- a/app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb +++ b/app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb @@ -19,7 +19,7 @@ class Api::V1::Statuses::RebloggedByAccountsController < Api::V1::Statuses::Base end def default_accounts - Account.without_suspended.includes(:statuses, :account_stat).references(:statuses) + Account.without_suspended.includes(:statuses, :account_stat, :user).references(:statuses) end def paginated_statuses diff --git a/app/controllers/api/v2/filters_controller.rb b/app/controllers/api/v2/filters_controller.rb index 2fcdeeae45..09d4813f34 100644 --- a/app/controllers/api/v2/filters_controller.rb +++ b/app/controllers/api/v2/filters_controller.rb @@ -35,7 +35,7 @@ class Api::V2::FiltersController < Api::BaseController private def set_filters - @filters = current_account.custom_filters.includes(:keywords) + @filters = current_account.custom_filters.includes(:keywords, :statuses) end def set_filter diff --git a/app/models/account_suggestions.rb b/app/models/account_suggestions.rb index d62176c7ca..25c8b04d50 100644 --- a/app/models/account_suggestions.rb +++ b/app/models/account_suggestions.rb @@ -29,7 +29,7 @@ class AccountSuggestions # a complicated query on this end. account_ids = account_ids_with_sources[offset, limit] - accounts_map = Account.where(id: account_ids.map(&:first)).includes(:account_stat).index_by(&:id) + accounts_map = Account.where(id: account_ids.map(&:first)).includes(:account_stat, :user).index_by(&:id) account_ids.filter_map do |(account_id, source)| next unless accounts_map.key?(account_id) diff --git a/app/models/report.rb b/app/models/report.rb index 126701b3d6..38da26d7b7 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -41,7 +41,7 @@ class Report < ApplicationRecord scope :unresolved, -> { where(action_taken_at: nil) } scope :resolved, -> { where.not(action_taken_at: nil) } - scope :with_accounts, -> { includes([:account, :target_account, :action_taken_by_account, :assigned_account].index_with({ user: [:invite_request, :invite] })) } + scope :with_accounts, -> { includes([:account, :target_account, :action_taken_by_account, :assigned_account].index_with([:account_stat, { user: [:invite_request, :invite, :ips] }])) } # A report is considered local if the reporter is local delegate :local?, to: :account From 61a0ec69fcf5565a96c2cc53167f74e6ff0391d8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 23 Jan 2024 12:44:50 +0100 Subject: [PATCH 8/9] chore(deps): update devdependencies (non-major) (#28840) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Renaud Chaput --- .devcontainer/codespaces/devcontainer.json | 18 ++++----- .devcontainer/devcontainer.json | 16 ++++---- jsconfig.json | 4 +- streaming/tsconfig.json | 4 +- tsconfig.json | 8 ++-- yarn.lock | 46 +++++++++++----------- 6 files changed, 48 insertions(+), 48 deletions(-) diff --git a/.devcontainer/codespaces/devcontainer.json b/.devcontainer/codespaces/devcontainer.json index ca9156fdaa..b32e4026d2 100644 --- a/.devcontainer/codespaces/devcontainer.json +++ b/.devcontainer/codespaces/devcontainer.json @@ -5,7 +5,7 @@ "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", "features": { - "ghcr.io/devcontainers/features/sshd:1": {} + "ghcr.io/devcontainers/features/sshd:1": {}, }, "runServices": ["app", "db", "redis"], @@ -15,16 +15,16 @@ "portsAttributes": { "3000": { "label": "web", - "onAutoForward": "notify" + "onAutoForward": "notify", }, "4000": { "label": "stream", - "onAutoForward": "silent" - } + "onAutoForward": "silent", + }, }, "otherPortsAttributes": { - "onAutoForward": "silent" + "onAutoForward": "silent", }, "remoteEnv": { @@ -33,7 +33,7 @@ "STREAMING_API_BASE_URL": "https://${localEnv:CODESPACE_NAME}-4000.app.github.dev", "DISABLE_FORGERY_REQUEST_PROTECTION": "true", "ES_ENABLED": "", - "LIBRE_TRANSLATE_ENDPOINT": "" + "LIBRE_TRANSLATE_ENDPOINT": "", }, "onCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", @@ -43,7 +43,7 @@ "customizations": { "vscode": { "settings": {}, - "extensions": ["EditorConfig.EditorConfig", "webben.browserslist"] - } - } + "extensions": ["EditorConfig.EditorConfig", "webben.browserslist"], + }, + }, } diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index fa8d6542c1..ed71235b3b 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,7 +5,7 @@ "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", "features": { - "ghcr.io/devcontainers/features/sshd:1": {} + "ghcr.io/devcontainers/features/sshd:1": {}, }, "forwardPorts": [3000, 4000], @@ -14,17 +14,17 @@ "3000": { "label": "web", "onAutoForward": "notify", - "requireLocalPort": true + "requireLocalPort": true, }, "4000": { "label": "stream", "onAutoForward": "silent", - "requireLocalPort": true - } + "requireLocalPort": true, + }, }, "otherPortsAttributes": { - "onAutoForward": "silent" + "onAutoForward": "silent", }, "onCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", @@ -34,7 +34,7 @@ "customizations": { "vscode": { "settings": {}, - "extensions": ["EditorConfig.EditorConfig", "webben.browserslist"] - } - } + "extensions": ["EditorConfig.EditorConfig", "webben.browserslist"], + }, + }, } diff --git a/jsconfig.json b/jsconfig.json index d52816a98b..7b710de83c 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -11,7 +11,7 @@ "noEmit": true, "resolveJsonModule": true, "strict": false, - "target": "ES2022" + "target": "ES2022", }, - "exclude": ["**/build/*", "**/node_modules/*", "**/public/*", "**/vendor/*"] + "exclude": ["**/build/*", "**/node_modules/*", "**/public/*", "**/vendor/*"], } diff --git a/streaming/tsconfig.json b/streaming/tsconfig.json index f7bb711b9b..a0cf68ef90 100644 --- a/streaming/tsconfig.json +++ b/streaming/tsconfig.json @@ -6,7 +6,7 @@ "moduleResolution": "node", "noUnusedParameters": false, "tsBuildInfoFile": "../tmp/cache/streaming/tsconfig.tsbuildinfo", - "paths": {} + "paths": {}, }, - "include": ["./*.js", "./.eslintrc.js"] + "include": ["./*.js", "./.eslintrc.js"], } diff --git a/tsconfig.json b/tsconfig.json index a193ea35f2..dc71fc4a9c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,12 +15,12 @@ "paths": { "mastodon": ["app/javascript/mastodon"], "mastodon/*": ["app/javascript/mastodon/*"], - "@/*": ["app/javascript/*"] - } + "@/*": ["app/javascript/*"], + }, }, "include": [ "app/javascript/mastodon", "app/javascript/packs", - "app/javascript/types" - ] + "app/javascript/types", + ], } diff --git a/yarn.lock b/yarn.lock index aca2278f9f..61f699d19e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1538,7 +1538,7 @@ __metadata: languageName: node linkType: hard -"@csstools/css-parser-algorithms@npm:^2.4.0": +"@csstools/css-parser-algorithms@npm:^2.5.0": version: 2.5.0 resolution: "@csstools/css-parser-algorithms@npm:2.5.0" peerDependencies: @@ -1547,14 +1547,14 @@ __metadata: languageName: node linkType: hard -"@csstools/css-tokenizer@npm:^2.2.2": +"@csstools/css-tokenizer@npm:^2.2.3": version: 2.2.3 resolution: "@csstools/css-tokenizer@npm:2.2.3" checksum: 557266ec52e8b36c19008a5bbd7151effba085cdd6d68270c01afebf914981caac698eda754b2a530a8a9947a3dd70e3f3a39a5e037c4170bb2a055a92754acb languageName: node linkType: hard -"@csstools/media-query-list-parser@npm:^2.1.6": +"@csstools/media-query-list-parser@npm:^2.1.7": version: 2.1.7 resolution: "@csstools/media-query-list-parser@npm:2.1.7" peerDependencies: @@ -1777,8 +1777,8 @@ __metadata: linkType: hard "@formatjs/cli@npm:^6.1.1": - version: 6.2.4 - resolution: "@formatjs/cli@npm:6.2.4" + version: 6.2.6 + resolution: "@formatjs/cli@npm:6.2.6" peerDependencies: vue: ^3.3.4 peerDependenciesMeta: @@ -1786,7 +1786,7 @@ __metadata: optional: true bin: formatjs: bin/formatjs - checksum: 3f6bbbc633a3a6ebd4e6fcfc3a9f889bc044043452cbc8f81abcaee97aaef991a778ae785d3b9d21ecc5f55b147eb0009b44520bb895fe244b4c14a36d9b05bd + checksum: f8b0bc45c72b83437f0dc91a2d3ea513852c11bfd8eedbc2f255b19552f153bccb4d38fcd281f897ca60d0dfddf2b99de22e5a87cb1e173ca11df88c61cde2e4 languageName: node linkType: hard @@ -11330,10 +11330,10 @@ __metadata: languageName: node linkType: hard -"meow@npm:^13.0.0": - version: 13.0.0 - resolution: "meow@npm:13.0.0" - checksum: fab0f91578154c048e792a81704f3f28099ffff900f364df8a85f6e770a57e1c124859a25e186186e149dad30692c7893af0dfd71517bea343bfe5d749b1fa04 +"meow@npm:^13.1.0": + version: 13.1.0 + resolution: "meow@npm:13.1.0" + checksum: 2dac9dbf99a17ce29618fe5919072a9b28e2aedb9547f9b1f15d046d5501dd6c14fe1f35f7a5665d0ee7111c98c4d359fcf3f985463ec5896dd50177363f442d languageName: node linkType: hard @@ -13200,7 +13200,7 @@ __metadata: languageName: node linkType: hard -"postcss@npm:^8.2.15, postcss@npm:^8.4.24, postcss@npm:^8.4.32": +"postcss@npm:^8.2.15, postcss@npm:^8.4.24, postcss@npm:^8.4.33": version: 8.4.33 resolution: "postcss@npm:8.4.33" dependencies: @@ -13295,11 +13295,11 @@ __metadata: linkType: hard "prettier@npm:^3.0.0": - version: 3.2.2 - resolution: "prettier@npm:3.2.2" + version: 3.2.4 + resolution: "prettier@npm:3.2.4" bin: prettier: bin/prettier.cjs - checksum: e84d0d2a4ce2b88ee1636904effbdf68b59da63d9f887128f2ed5382206454185432e7c0a9578bc4308bc25d099cfef47fd0b9c211066777854e23e65e34044d + checksum: 88dfeb78ac6096522c9a5b81f1413d875f568420d9bb6a5e5103527912519b993f2bcdcac311fcff5718d5869671d44e4f85827d3626f3a6ce32b9abc65d88e0 languageName: node linkType: hard @@ -15785,12 +15785,12 @@ __metadata: linkType: hard "stylelint@npm:^16.0.2": - version: 16.1.0 - resolution: "stylelint@npm:16.1.0" + version: 16.2.0 + resolution: "stylelint@npm:16.2.0" dependencies: - "@csstools/css-parser-algorithms": "npm:^2.4.0" - "@csstools/css-tokenizer": "npm:^2.2.2" - "@csstools/media-query-list-parser": "npm:^2.1.6" + "@csstools/css-parser-algorithms": "npm:^2.5.0" + "@csstools/css-tokenizer": "npm:^2.2.3" + "@csstools/media-query-list-parser": "npm:^2.1.7" "@csstools/selector-specificity": "npm:^3.0.1" balanced-match: "npm:^2.0.0" colord: "npm:^2.9.3" @@ -15810,14 +15810,14 @@ __metadata: is-plain-object: "npm:^5.0.0" known-css-properties: "npm:^0.29.0" mathml-tag-names: "npm:^2.1.3" - meow: "npm:^13.0.0" + meow: "npm:^13.1.0" micromatch: "npm:^4.0.5" normalize-path: "npm:^3.0.0" picocolors: "npm:^1.0.0" - postcss: "npm:^8.4.32" + postcss: "npm:^8.4.33" postcss-resolve-nested-selector: "npm:^0.1.1" postcss-safe-parser: "npm:^7.0.0" - postcss-selector-parser: "npm:^6.0.13" + postcss-selector-parser: "npm:^6.0.15" postcss-value-parser: "npm:^4.2.0" resolve-from: "npm:^5.0.0" string-width: "npm:^4.2.3" @@ -15828,7 +15828,7 @@ __metadata: write-file-atomic: "npm:^5.0.1" bin: stylelint: bin/stylelint.mjs - checksum: 765eea0b07319d1e7989502c07b8b5794938e5a8542bec00990b09ec10c3f7006891689930099e948d06c9ef9982066edb98b1ea64a435138a6b0f0905eb2b87 + checksum: 6fdf0451833c11b18c9aa502f687febd6881a912ac94f39d509b894b0f74ccb636f3dac2991c69cc82dc6190731cc2fa48e307fed477d2a0fce57067cd22b572 languageName: node linkType: hard From 01ce9df88008cee705b7e02a4581802afa07c3df Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 24 Jan 2024 08:03:30 +0100 Subject: [PATCH 9/9] Fix search form re-rendering spuriously in web UI (#28876) --- .../features/compose/containers/search_container.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/features/compose/containers/search_container.js b/app/javascript/mastodon/features/compose/containers/search_container.js index 758b6b07db..616b91369c 100644 --- a/app/javascript/mastodon/features/compose/containers/search_container.js +++ b/app/javascript/mastodon/features/compose/containers/search_container.js @@ -1,3 +1,4 @@ +import { createSelector } from '@reduxjs/toolkit'; import { connect } from 'react-redux'; import { @@ -12,10 +13,15 @@ import { import Search from '../components/search'; +const getRecentSearches = createSelector( + state => state.getIn(['search', 'recent']), + recent => recent.reverse(), +); + const mapStateToProps = state => ({ value: state.getIn(['search', 'value']), submitted: state.getIn(['search', 'submitted']), - recent: state.getIn(['search', 'recent']).reverse(), + recent: getRecentSearches(state), }); const mapDispatchToProps = dispatch => ({