From 8eb74c88ec3a2d8cc1ec722e3b7a74023ea341a8 Mon Sep 17 00:00:00 2001 From: Claire Date: Sun, 12 Feb 2023 18:16:08 +0100 Subject: [PATCH 1/3] New Crowdin updates (#2100) * New translations en.json (Korean) [ci skip] * New translations en.json (Portuguese, Brazilian) [ci skip] * New translations en.yml (Spanish) [ci skip] * New translations en.yml (Portuguese) [ci skip] * New translations en.yml (Portuguese) [ci skip] * New translations en.json (Spanish) [ci skip] * New translations en.yml (Spanish) [ci skip] * New translations en.json (Spanish) [ci skip] --- .../flavours/glitch/locales/es.json | 16 +++++++++++ .../flavours/glitch/locales/ko.json | 1 + .../flavours/glitch/locales/pt-BR.json | 5 ++-- config/locales-glitch/es.yml | 9 ++++++ config/locales-glitch/pt-PT.yml | 28 ++++++++++++++++++- 5 files changed, 56 insertions(+), 3 deletions(-) diff --git a/app/javascript/flavours/glitch/locales/es.json b/app/javascript/flavours/glitch/locales/es.json index 07acbf914..7231fe135 100644 --- a/app/javascript/flavours/glitch/locales/es.json +++ b/app/javascript/flavours/glitch/locales/es.json @@ -1,4 +1,10 @@ { + "account.follows": "Sigue", + "account.suspended_disclaimer_full": "Este usuario ha sido suspendido por un moderador.", + "account.view_full_profile": "Ver perfil completo", + "account_note.cancel": "Cancelar", + "account_note.edit": "Editar", + "account_note.save": "Guardar", "advanced_options.icon_title": "Opciones avanzadas", "advanced_options.local-only.long": "No publicar a otras instancias", "advanced_options.local-only.short": "Local", @@ -6,9 +12,17 @@ "advanced_options.threaded_mode.long": "Al publicar abre automáticamente una respuesta", "advanced_options.threaded_mode.short": "Modo hilo", "advanced_options.threaded_mode.tooltip": "Modo hilo habilitado", + "column.favourited_by": "Marcado como favorito por", + "column.reblogged_by": "Retooteado por", + "column_header.profile": "Perfil", + "column_subheading.lists": "Listas", + "column_subheading.navigation": "Navegación", "compose.attach": "Adjuntar...", "compose.attach.doodle": "Dibujar algo", "compose.attach.upload": "Subir un archivo", + "compose.content-type.html": "HTML", + "compose.content-type.markdown": "Markdown", + "compose.content-type.plain": "Sin formato", "confirmations.unfilter.author": "Publicado por", "confirmations.unfilter.confirm": "Mostrar", "confirmations.unfilter.edit_filter": "Editar filtro", @@ -91,5 +105,7 @@ "settings.tag_misleading_links.hint": "Añadir una indicación visual indicando el destino de los enlace que no los mencionen explícitamente", "settings.wide_view": "Vista amplia (solo modo de escritorio)", "status.collapse": "Colapsar", + "status.in_reply_to": "Este toot es una respuesta", + "status.is_poll": "Este toot es una encuesta", "status.uncollapse": "Descolapsar" } diff --git a/app/javascript/flavours/glitch/locales/ko.json b/app/javascript/flavours/glitch/locales/ko.json index f17f32a9d..045a3894b 100644 --- a/app/javascript/flavours/glitch/locales/ko.json +++ b/app/javascript/flavours/glitch/locales/ko.json @@ -103,6 +103,7 @@ "settings.auto_collapse_all": "모두", "settings.auto_collapse_lengthy": "긴 글", "settings.auto_collapse_media": "미디어 포함 글", + "settings.auto_collapse_height": "길이가 긴 것으로 간주할 툿이 높이 (픽셀 단위)", "settings.auto_collapse_notifications": "알림", "settings.auto_collapse_reblogs": "부스트", "settings.auto_collapse_replies": "답글", diff --git a/app/javascript/flavours/glitch/locales/pt-BR.json b/app/javascript/flavours/glitch/locales/pt-BR.json index 0bc0d2bea..f658d3bdc 100644 --- a/app/javascript/flavours/glitch/locales/pt-BR.json +++ b/app/javascript/flavours/glitch/locales/pt-BR.json @@ -103,6 +103,7 @@ "settings.auto_collapse_all": "Tudo", "settings.auto_collapse_lengthy": "Toots longos", "settings.auto_collapse_media": "Toots com mídia", + "settings.auto_collapse_height": "Altura (em pixels) para um toot ser considerado longo", "settings.auto_collapse_notifications": "Notificações", "settings.auto_collapse_reblogs": "Impulsos", "settings.auto_collapse_replies": "Respostas", @@ -112,7 +113,7 @@ "settings.confirm_before_clearing_draft": "Mostrar diálogo de confirmação antes de sobrescrever a mensagem que está sendo composta", "settings.confirm_boost_missing_media_description": "Mostrar diálogo antes de inpulsionar os toots sem descrições de mídia", "settings.confirm_missing_media_description": "Mostrar diálogo antes de enviar toots sem descrições de mídia", - "settings.content_warnings": "Content warnings", + "settings.content_warnings": "Aviso de Conteúdo", "settings.content_warnings.regexp": "Expressão regular", "settings.content_warnings_filter": "Avisos de conteúdo para não revelar automaticamente:", "settings.content_warnings_media_outside": "Exibir anexos de mídia fora avisos de conteúdo", @@ -148,7 +149,7 @@ "settings.pop_in_player": "Ativar player pop-in", "settings.pop_in_position": "Posição do player:", "settings.pop_in_right": "Direita", - "settings.preferences": "Preferences", + "settings.preferences": "Preferências do usuário", "settings.prepend_cw_re": "Preparar \"re: \" para avisos de conteúdo quando responder", "settings.preselect_on_reply": "Nome de usuário pré-selecionado na resposta", "settings.preselect_on_reply_hint": "Ao responder a uma conversa com vários participantes, pré-selecionar nomes de usuários após o primeiro", diff --git a/config/locales-glitch/es.yml b/config/locales-glitch/es.yml index d842deb67..f7f068faa 100644 --- a/config/locales-glitch/es.yml +++ b/config/locales-glitch/es.yml @@ -1,6 +1,9 @@ --- es: admin: + custom_emojis: + batch_copy_error: 'Se produjo un error cuando se copian algunos emojis seleccionados %{message}' + batch_error: 'Ocurrió un error %{message}' settings: hide_followers_count: desc_html: No mostrar el conteo de seguidorxs en perfiles de usuarix @@ -14,6 +17,12 @@ es: show_replies_in_public_timelines: desc_html: Además de auto-respuestas públicas (hilos), mostrar respuestas públicas en las línea de tiempo local y pública. title: Mostrar respuestas en líneas de tiempo públicas + trending_status_cw: + title: Permitir que toots con advertencias de contenido sean tendencia + appearance: + localization: + glitch_guide_link: https://crowdin.com/project/glitch-soc + glitch_guide_link_text: Al igual que para glitch-soc! generic: use_this: Usar settings: diff --git a/config/locales-glitch/pt-PT.yml b/config/locales-glitch/pt-PT.yml index a1a2dc36b..6af5de0a7 100644 --- a/config/locales-glitch/pt-PT.yml +++ b/config/locales-glitch/pt-PT.yml @@ -1 +1,27 @@ -pt-PT: +--- +pt: + admin: + custom_emojis: + batch_copy_error: 'Houve um erro ao copiar alguns dos emoji selecionados: %{message}' + batch_error: 'Houve um erro: %{message}' + settings: + captcha_enabled: + desc_html: Isto depende de scripts externos da hCaptcha, o que pode ser uma preocupação de segurança e privacidade. Além disso, isto pode tornar o processo de registo menos acessível para algumas pessoas (especialmente as com limitações físicas). Por isto, considera medidas alternativas tais como registo mediante aprovação ou sob convite.
Pessoas que se registam com um convite não precisam de resolver um CAPTCHA + title: Exigir que novas contas resolvam um CAPTCHA para validar o registo + flavour_and_skin: + title: Sabor e tema + hide_followers_count: + desc_html: Não mostrar o número de seguidores nos perfis + title: Esconder o número de seguidores + other: + preamble: Várias opções do glitch-soc que não cabem noutras categorias. + title: Outras opções + outgoing_spoilers: + desc_html: Ao federar toots, juntar este aviso de conteúdo aos toots que não têm aviso. Isto é útil se o teu servidor for especializado em conteúdos que outros servidores podem querer ter sob um Aviso de Conteúdo. Os media também vão ser marcados como sensíveis. + title: Aviso de conteúdo para toots enviados + show_reblogs_in_public_timelines: + desc_html: Mostrar boosts públicos de toots públicos nas linhas de tempo locais e públicas. + title: Mostrar boosts nas timelines públicas + show_replies_in_public_timelines: + desc_html: Além de auto-respostas públicas (fios), mostrar as respostas públicas em linhas de tempo locais e públicas. + title: Mostrar respostas nas linhas de tempo públicas From ee4250545236e4330c46b43f4abfe94ad323d4d4 Mon Sep 17 00:00:00 2001 From: Dean Bassett Date: Sun, 12 Feb 2023 09:58:02 -0800 Subject: [PATCH 2/3] fix hashtag ordering (#2107) Co-authored-by: Eugen Rochko --- app/javascript/flavours/glitch/reducers/compose.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/javascript/flavours/glitch/reducers/compose.js b/app/javascript/flavours/glitch/reducers/compose.js index bb42580d4..57ab36b3d 100644 --- a/app/javascript/flavours/glitch/reducers/compose.js +++ b/app/javascript/flavours/glitch/reducers/compose.js @@ -282,9 +282,9 @@ const sortHashtagsByUse = (state, tags) => { if (usedA === usedB) { return 0; } else if (usedA && !usedB) { - return 1; - } else { return -1; + } else { + return 1; } }); }; From cdf30cf5dbbc2557cab609263cc3522ee9ca0ba3 Mon Sep 17 00:00:00 2001 From: Thor Date: Sat, 18 Feb 2023 09:52:48 +0000 Subject: [PATCH 3/3] Allow full-text search on federated content --- app/chewy/statuses_index.rb | 12 ++++---- app/lib/importer/statuses_index_importer.rb | 31 ++++----------------- app/models/status.rb | 22 --------------- app/services/search_service.rb | 2 +- 4 files changed, 11 insertions(+), 56 deletions(-) diff --git a/app/chewy/statuses_index.rb b/app/chewy/statuses_index.rb index 6dd4fb18b..d3f6551c2 100644 --- a/app/chewy/statuses_index.rb +++ b/app/chewy/statuses_index.rb @@ -38,27 +38,27 @@ class StatusesIndex < Chewy::Index index_scope ::Status.unscoped.kept.without_reblogs.includes(:media_attachments, :preloadable_poll) crutch :mentions do |collection| - data = ::Mention.where(status_id: collection.map(&:id)).where(account: Account.local, silent: false).pluck(:status_id, :account_id) + data = ::Mention.where(status_id: collection.map(&:id)).where(silent: false).pluck(:status_id, :account_id) data.each.with_object({}) { |(id, name), result| (result[id] ||= []).push(name) } end crutch :favourites do |collection| - data = ::Favourite.where(status_id: collection.map(&:id)).where(account: Account.local).pluck(:status_id, :account_id) + data = ::Favourite.where(status_id: collection.map(&:id)).pluck(:status_id, :account_id) data.each.with_object({}) { |(id, name), result| (result[id] ||= []).push(name) } end crutch :reblogs do |collection| - data = ::Status.where(reblog_of_id: collection.map(&:id)).where(account: Account.local).pluck(:reblog_of_id, :account_id) + data = ::Status.where(reblog_of_id: collection.map(&:id)).pluck(:reblog_of_id, :account_id) data.each.with_object({}) { |(id, name), result| (result[id] ||= []).push(name) } end crutch :bookmarks do |collection| - data = ::Bookmark.where(status_id: collection.map(&:id)).where(account: Account.local).pluck(:status_id, :account_id) + data = ::Bookmark.where(status_id: collection.map(&:id)).pluck(:status_id, :account_id) data.each.with_object({}) { |(id, name), result| (result[id] ||= []).push(name) } end crutch :votes do |collection| - data = ::PollVote.joins(:poll).where(poll: { status_id: collection.map(&:id) }).where(account: Account.local).pluck(:status_id, :account_id) + data = ::PollVote.joins(:poll).where(poll: { status_id: collection.map(&:id) }).pluck(:status_id, :account_id) data.each.with_object({}) { |(id, name), result| (result[id] ||= []).push(name) } end @@ -69,7 +69,5 @@ class StatusesIndex < Chewy::Index field :text, type: 'text', value: ->(status) { status.searchable_text } do field :stemmed, type: 'text', analyzer: 'content' end - - field :searchable_by, type: 'long', value: ->(status, crutches) { status.searchable_by(crutches) } end end diff --git a/app/lib/importer/statuses_index_importer.rb b/app/lib/importer/statuses_index_importer.rb index 5b5153d5c..84ff658e7 100644 --- a/app/lib/importer/statuses_index_importer.rb +++ b/app/lib/importer/statuses_index_importer.rb @@ -17,30 +17,9 @@ class Importer::StatusesIndexImporter < Importer::BaseImporter Chewy::Index::Import::BulkBuilder.new(index, to_index: Status.includes(:media_attachments, :preloadable_poll).where(id: status_ids)).bulk_body end - indexed = 0 + indexed = bulk.length deleted = 0 - # We can't use the delete_if proc to do the filtering because delete_if - # is called before rendering the data and we need to filter based - # on the results of the filter, so this filtering happens here instead - bulk.map! do |entry| - new_entry = begin - if entry[:index] && entry.dig(:index, :data, 'searchable_by').blank? - { delete: entry[:index].except(:data) } - else - entry - end - end - - if new_entry[:index] - indexed += 1 - else - deleted += 1 - end - - new_entry - end - Chewy::Index::Import::BulkRequest.new(index).perform(bulk) [indexed, deleted] @@ -68,11 +47,11 @@ class Importer::StatusesIndexImporter < Importer::BaseImporter end def local_mentions_scope - Mention.where(account: Account.local, silent: false).select(:id, :status_id) + Mention.where(silent: false).select(:id, :status_id) end def local_favourites_scope - Favourite.where(account: Account.local).select(:id, :status_id) + Favourite.select(:id, :status_id) end def local_bookmarks_scope @@ -80,10 +59,10 @@ class Importer::StatusesIndexImporter < Importer::BaseImporter end def local_votes_scope - Poll.joins(:votes).where(votes: { account: Account.local }).select('polls.id, polls.status_id') + Poll.joins(:votes).select('polls.id, polls.status_id') end def local_statuses_scope - Status.local.select('"statuses"."id", COALESCE("statuses"."reblog_of_id", "statuses"."id") AS status_id') + Status.select('"statuses"."id", COALESCE("statuses"."reblog_of_id", "statuses"."id") AS status_id') end end diff --git a/app/models/status.rb b/app/models/status.rb index 4e4d960a4..8a0f1d21b 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -141,28 +141,6 @@ class Status < ApplicationRecord REAL_TIME_WINDOW = 6.hours - def searchable_by(preloaded = nil) - ids = [] - - ids << account_id if local? - - if preloaded.nil? - ids += mentions.joins(:account).merge(Account.local).active.pluck(:account_id) - ids += favourites.joins(:account).merge(Account.local).pluck(:account_id) - ids += reblogs.joins(:account).merge(Account.local).pluck(:account_id) - ids += bookmarks.joins(:account).merge(Account.local).pluck(:account_id) - ids += poll.votes.joins(:account).merge(Account.local).pluck(:account_id) if poll.present? - else - ids += preloaded.mentions[id] || [] - ids += preloaded.favourites[id] || [] - ids += preloaded.reblogs[id] || [] - ids += preloaded.bookmarks[id] || [] - ids += preloaded.votes[id] || [] - end - - ids.uniq - end - def searchable_text [ spoiler_text, diff --git a/app/services/search_service.rb b/app/services/search_service.rb index 1a76cbb38..2f72b25d2 100644 --- a/app/services/search_service.rb +++ b/app/services/search_service.rb @@ -35,7 +35,7 @@ class SearchService < BaseService end def perform_statuses_search! - definition = parsed_query.apply(StatusesIndex.filter(term: { searchable_by: @account.id })) + definition = parsed_query.apply(StatusesIndex) if @options[:account_id].present? definition = definition.filter(term: { account_id: @options[:account_id] })