From 1fc14e324bf103e379cf73ffceebbf46472cccde Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 2 Jul 2024 10:41:54 +0200 Subject: [PATCH 01/11] New Crowdin Translations (automated) (#30890) Co-authored-by: GitHub Actions --- app/javascript/mastodon/locales/en-GB.json | 8 ++++++++ app/javascript/mastodon/locales/sk.json | 3 +++ config/locales/doorkeeper.en-GB.yml | 2 ++ config/locales/en-GB.yml | 3 +++ 4 files changed, 16 insertions(+) diff --git a/app/javascript/mastodon/locales/en-GB.json b/app/javascript/mastodon/locales/en-GB.json index c4f401d86d..94d7defc7e 100644 --- a/app/javascript/mastodon/locales/en-GB.json +++ b/app/javascript/mastodon/locales/en-GB.json @@ -35,7 +35,9 @@ "account.follow_back": "Follow back", "account.followers": "Followers", "account.followers.empty": "No one follows this user yet.", + "account.followers_counter": "{count, plural, one {{counter} follower} other {{counter} followers}}", "account.following": "Following", + "account.following_counter": "{count, plural, one {{counter} following} other {{counter} following}}", "account.follows.empty": "This user doesn't follow anyone yet.", "account.go_to_profile": "Go to profile", "account.hide_reblogs": "Hide boosts from @{name}", @@ -61,6 +63,7 @@ "account.requested_follow": "{name} has requested to follow you", "account.share": "Share @{name}'s profile", "account.show_reblogs": "Show boosts from @{name}", + "account.statuses_counter": "{count, plural, one {{counter} post} other {{counter} posts}}", "account.unblock": "Unblock @{name}", "account.unblock_domain": "Unblock domain {domain}", "account.unblock_short": "Unblock", @@ -411,6 +414,8 @@ "limited_account_hint.action": "Show profile anyway", "limited_account_hint.title": "This profile has been hidden by the moderators of {domain}.", "link_preview.author": "By {name}", + "link_preview.more_from_author": "More from {name}", + "link_preview.shares": "{count, plural, one {{counter} post} other {{counter} posts}}", "lists.account.add": "Add to list", "lists.account.remove": "Remove from list", "lists.delete": "Delete list", @@ -691,8 +696,11 @@ "server_banner.about_active_users": "People using this server during the last 30 days (Monthly Active Users)", "server_banner.active_users": "active users", "server_banner.administered_by": "Administered by:", + "server_banner.is_one_of_many": "{domain} is one of the many independent Mastodon servers you can use to participate in the fediverse.", "server_banner.server_stats": "Server stats:", "sign_in_banner.create_account": "Create account", + "sign_in_banner.follow_anyone": "Follow anyone across the fediverse and see it all in chronological order. No algorithms, ads, or clickbait in sight.", + "sign_in_banner.mastodon_is": "Mastodon is the best way to keep up with what's happening.", "sign_in_banner.sign_in": "Sign in", "sign_in_banner.sso_redirect": "Login or Register", "status.admin_account": "Open moderation interface for @{name}", diff --git a/app/javascript/mastodon/locales/sk.json b/app/javascript/mastodon/locales/sk.json index ed9c0de604..ed877f7667 100644 --- a/app/javascript/mastodon/locales/sk.json +++ b/app/javascript/mastodon/locales/sk.json @@ -88,7 +88,10 @@ "audio.hide": "Skryť zvuk", "block_modal.show_less": "Zobraziť menej", "block_modal.show_more": "Zobraziť viac", + "block_modal.they_cant_mention": "Nemôžu ťa spomenúť, alebo nasledovať.", + "block_modal.they_will_know": "Môžu vidieť, že sú zablokovaní/ý.", "block_modal.title": "Blokovať užívateľa?", + "block_modal.you_wont_see_mentions": "Neuvidíš príspevky, ktoré ich spomínajú.", "boost_modal.combo": "Nabudúce môžete preskočiť stlačením {combo}", "bundle_column_error.copy_stacktrace": "Kopírovať chybovú hlášku", "bundle_column_error.error.body": "Požadovanú stránku nebolo možné vykresliť. Môže to byť spôsobené chybou v našom kóde alebo problémom s kompatibilitou prehliadača.", diff --git a/config/locales/doorkeeper.en-GB.yml b/config/locales/doorkeeper.en-GB.yml index b3ceffb13f..f254825b1b 100644 --- a/config/locales/doorkeeper.en-GB.yml +++ b/config/locales/doorkeeper.en-GB.yml @@ -135,6 +135,7 @@ en-GB: media: Media attachments mutes: Mutes notifications: Notifications + profile: Your Mastodon profile push: Push notifications reports: Reports search: Search @@ -165,6 +166,7 @@ en-GB: admin:write:reports: perform moderation actions on reports crypto: use end-to-end encryption follow: modify account relationships + profile: read only your account's profile information push: receive your push notifications read: read all your account's data read:accounts: see accounts information diff --git a/config/locales/en-GB.yml b/config/locales/en-GB.yml index 07eb84ebbe..928823b995 100644 --- a/config/locales/en-GB.yml +++ b/config/locales/en-GB.yml @@ -285,6 +285,7 @@ en-GB: update_custom_emoji_html: "%{name} updated emoji %{target}" update_domain_block_html: "%{name} updated domain block for %{target}" update_ip_block_html: "%{name} changed rule for IP %{target}" + update_report_html: "%{name} updated report %{target}" update_status_html: "%{name} updated post by %{target}" update_user_role_html: "%{name} changed %{target} role" deleted_account: deleted account @@ -292,6 +293,7 @@ en-GB: filter_by_action: Filter by action filter_by_user: Filter by user title: Audit log + unavailable_instance: "(domain name unavailable)" announcements: destroyed_msg: Announcement successfully deleted! edit: @@ -950,6 +952,7 @@ en-GB: delete: Delete edit_preset: Edit warning preset empty: You haven't defined any warning presets yet. + title: Warning presets webhooks: add_new: Add endpoint delete: Delete From ebd8e1bbb6465c78f6542fe7f09938fdb768dbb7 Mon Sep 17 00:00:00 2001 From: David Roetzel Date: Wed, 3 Jul 2024 09:19:54 +0200 Subject: [PATCH 02/11] Add system check for missing database indexes (#30888) --- Gemfile | 1 + Gemfile.lock | 2 + app/lib/admin/db/schema_parser.rb | 92 +++++++++++++++++++ app/lib/admin/system_check.rb | 1 + .../system_check/missing_indexes_check.rb | 36 ++++++++ config/locales/en.yml | 2 + spec/lib/admin/db/schema_parser_spec.rb | 49 ++++++++++ .../missing_indexes_check_spec.rb | 65 +++++++++++++ 8 files changed, 248 insertions(+) create mode 100644 app/lib/admin/db/schema_parser.rb create mode 100644 app/lib/admin/system_check/missing_indexes_check.rb create mode 100644 spec/lib/admin/db/schema_parser_spec.rb create mode 100644 spec/lib/admin/system_check/missing_indexes_check_spec.rb diff --git a/Gemfile b/Gemfile index be3f9e6f98..0d6cc4c4e1 100644 --- a/Gemfile +++ b/Gemfile @@ -229,3 +229,4 @@ gem 'rubyzip', '~> 2.3' gem 'hcaptcha', '~> 7.1' gem 'mail', '~> 2.8' +gem 'prism' diff --git a/Gemfile.lock b/Gemfile.lock index 42cc0e1986..969d18493a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -600,6 +600,7 @@ GEM actionmailer (>= 3) net-smtp premailer (~> 1.7, >= 1.7.9) + prism (0.30.0) propshaft (0.9.0) actionpack (>= 7.0.0) activesupport (>= 7.0.0) @@ -1003,6 +1004,7 @@ DEPENDENCIES pg (~> 1.5) pghero premailer-rails + prism propshaft public_suffix (~> 6.0) puma (~> 6.3) diff --git a/app/lib/admin/db/schema_parser.rb b/app/lib/admin/db/schema_parser.rb new file mode 100644 index 0000000000..e61a2281ee --- /dev/null +++ b/app/lib/admin/db/schema_parser.rb @@ -0,0 +1,92 @@ +# frozen_string_literal: true + +class Admin::Db::SchemaParser + class Index + attr_reader :name, :table_name, :columns, :options + + def initialize(name:, table_name:, columns:, options:) + @name = name + @table_name = table_name + @columns = columns + @options = options + end + end + + attr_reader :indexes_by_table + + def initialize(source) + parse(source) + end + + private + + def parse(source) + @indexes_by_table = {} + queue = [Prism.parse(source).value] + while (node = queue.shift) + if node.type == :call_node && node.name == :create_table + parse_create_table(node) + elsif node.type == :call_node && node.name == :add_index + parse_add_index(node) + else + queue.concat(node.compact_child_nodes) + end + end + end + + def parse_create_table(node) + table_name = parse_arguments(node).first + queue = node.compact_child_nodes + while (node = queue.shift) + if node.type == :call_node && node.name == :index + parse_index(node, table_name:) + else + queue.concat(node.compact_child_nodes) + end + end + end + + def parse_index(node, table_name:) + arguments = parse_arguments(node) + save_index( + name: arguments.last[:name], + table_name: table_name, + columns: arguments.first, + options: arguments.last + ) + end + + def parse_add_index(node) + arguments = parse_arguments(node) + save_index( + name: arguments.last[:name], + table_name: arguments.first, + columns: arguments[1], + options: arguments.last + ) + end + + def parse_arguments(node) + node.arguments.arguments.map { |a| parse_argument(a) } + end + + def parse_argument(argument) + case argument + when Prism::StringNode + argument.unescaped + when Prism::SymbolNode + argument.unescaped.to_sym + when Prism::ArrayNode + argument.elements.map { |e| parse_argument(e) } + when Prism::KeywordHashNode + argument.elements.to_h do |element| + [element.key.unescaped.to_sym, parse_argument(element.value)] + end + end + end + + def save_index(name:, table_name:, columns:, options:) + @indexes_by_table[table_name] ||= [] + @indexes_by_table[table_name] << Index.new(name:, table_name:, columns:, options:) + end +end diff --git a/app/lib/admin/system_check.rb b/app/lib/admin/system_check.rb index 25c88341a4..453011f7a6 100644 --- a/app/lib/admin/system_check.rb +++ b/app/lib/admin/system_check.rb @@ -8,6 +8,7 @@ class Admin::SystemCheck Admin::SystemCheck::SidekiqProcessCheck, Admin::SystemCheck::RulesCheck, Admin::SystemCheck::ElasticsearchCheck, + Admin::SystemCheck::MissingIndexesCheck, ].freeze def self.perform(current_user) diff --git a/app/lib/admin/system_check/missing_indexes_check.rb b/app/lib/admin/system_check/missing_indexes_check.rb new file mode 100644 index 0000000000..b7eecbb067 --- /dev/null +++ b/app/lib/admin/system_check/missing_indexes_check.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +class Admin::SystemCheck::MissingIndexesCheck < Admin::SystemCheck::BaseCheck + def skip? + !current_user.can?(:view_devops) + end + + def pass? + missing_indexes.none? + end + + def message + Admin::SystemCheck::Message.new(:missing_indexes_check, missing_indexes.join(', ')) + end + + private + + def missing_indexes + @missing_indexes ||= begin + expected_indexes_by_table.flat_map do |table, indexes| + expected_indexes = indexes.map(&:name) + expected_indexes - existing_indexes_for(table) + end + end + end + + def expected_indexes_by_table + schema_rb = Rails.root.join('db', 'schema.rb').read + schema_parser = Admin::Db::SchemaParser.new(schema_rb) + schema_parser.indexes_by_table + end + + def existing_indexes_for(table) + ActiveRecord::Base.connection.indexes(table).map(&:name) + end +end diff --git a/config/locales/en.yml b/config/locales/en.yml index 20df80c272..270382dd11 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -862,6 +862,8 @@ en: elasticsearch_version_check: message_html: 'Incompatible Elasticsearch version: %{value}' version_comparison: Elasticsearch %{running_version} is running while %{required_version} is required + missing_indexes_check: + message_html: 'The following indexes are missing from the database and should be recreated: %{value}.
Missing indexes may lead to severely reduced performance and data inconsistencies.' rules_check: action: Manage server rules message_html: You haven't defined any server rules. diff --git a/spec/lib/admin/db/schema_parser_spec.rb b/spec/lib/admin/db/schema_parser_spec.rb new file mode 100644 index 0000000000..e28d5c1f97 --- /dev/null +++ b/spec/lib/admin/db/schema_parser_spec.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe Admin::Db::SchemaParser do + let(:dummy_schema) do + <<~SCHEMA + # Comment + ActiveRecord::Schema[7.1].define(version: 23) do + create_table "people", force: :cascade do |t| + t.string "name" + end + + create_table "posts", force: :cascade do |t| + t.string "title", null: false + t.bigint "size", null: false + t.string "description" + # t.index ["size", "title"], name: "index_posts_on_size_and_title" + t.index ["title"], name: "index_posts_on_title", unique: true + t.index ["size"], name: "index_posts_on_size" + end + + # add_index "people", ["name"], name: "commented_out_index" + add_index "people", ["name"], name: "index_people_on_name" + end + SCHEMA + end + let(:schema_parser) { described_class.new(dummy_schema) } + + describe '#indexes_by_table' do + subject { schema_parser.indexes_by_table } + + it 'returns index info for all affected tables' do + expect(subject.keys).to match_array(%w(people posts)) + end + + it 'returns all index information for the `people` table' do + people_info = subject['people'] + expect(people_info.map(&:name)).to contain_exactly('index_people_on_name') + end + + it 'returns all index information for the `posts` table' do + posts_info = subject['posts'] + expect(posts_info.map(&:name)).to contain_exactly( + 'index_posts_on_title', 'index_posts_on_size' + ) + end + end +end diff --git a/spec/lib/admin/system_check/missing_indexes_check_spec.rb b/spec/lib/admin/system_check/missing_indexes_check_spec.rb new file mode 100644 index 0000000000..e183be5620 --- /dev/null +++ b/spec/lib/admin/system_check/missing_indexes_check_spec.rb @@ -0,0 +1,65 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe Admin::SystemCheck::MissingIndexesCheck do + subject(:check) { described_class.new(user) } + + let(:user) { Fabricate(:user) } + let(:schema_parser) do + instance_double(Admin::Db::SchemaParser, indexes_by_table: index_info) + end + let(:index_info) do + { + 'users' => [instance_double(Admin::Db::SchemaParser::Index, name: 'index_users_on_profile_id')], + 'posts' => [instance_double(Admin::Db::SchemaParser::Index, name: 'index_posts_on_user_id')], + } + end + let(:posts_indexes) { [] } + let(:users_indexes) { [] } + + before do + allow(Admin::Db::SchemaParser).to receive(:new).and_return(schema_parser) + allow(ActiveRecord::Base.connection).to receive(:indexes).with('posts').and_return(posts_indexes) + allow(ActiveRecord::Base.connection).to receive(:indexes).with('users').and_return(users_indexes) + end + + it_behaves_like 'a check available to devops users' + + describe '#pass?' do + context 'when indexes are missing' do + let(:posts_indexes) do + [instance_double(ActiveRecord::ConnectionAdapters::IndexDefinition, name: 'index_posts_on_user_id')] + end + + it 'returns false' do + expect(check.pass?).to be false + end + end + + context 'when all expected indexes are present' do + let(:posts_indexes) do + [instance_double(ActiveRecord::ConnectionAdapters::IndexDefinition, name: 'index_posts_on_user_id')] + end + let(:users_indexes) do + [instance_double(ActiveRecord::ConnectionAdapters::IndexDefinition, name: 'index_users_on_profile_id')] + end + + it 'returns true' do + expect(check.pass?).to be true + end + end + end + + describe '#message' do + subject { check.message } + + it 'sets the class name as the message key' do + expect(subject.key).to eq(:missing_indexes_check) + end + + it 'sets a list of missing indexes as message value' do + expect(subject.value).to eq('index_users_on_profile_id, index_posts_on_user_id') + end + end +end From 2e295bd5e7d3e7fefd4d4f03279f0dd0f3e5427d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 07:20:48 +0000 Subject: [PATCH 03/11] chore(deps): update dependency aws-sdk-s3 to v1.156.0 (#30899) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Gemfile.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 969d18493a..d855c05f43 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -100,19 +100,19 @@ GEM attr_required (1.0.2) awrence (1.2.1) aws-eventstream (1.3.0) - aws-partitions (1.949.0) - aws-sdk-core (3.200.0) + aws-partitions (1.950.0) + aws-sdk-core (3.201.0) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.8) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.87.0) - aws-sdk-core (~> 3, >= 3.199.0) - aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.155.0) - aws-sdk-core (~> 3, >= 3.199.0) + aws-sdk-kms (1.88.0) + aws-sdk-core (~> 3, >= 3.201.0) + aws-sigv4 (~> 1.5) + aws-sdk-s3 (1.156.0) + aws-sdk-core (~> 3, >= 3.201.0) aws-sdk-kms (~> 1) - aws-sigv4 (~> 1.8) + aws-sigv4 (~> 1.5) aws-sigv4 (1.8.0) aws-eventstream (~> 1, >= 1.0.2) azure-storage-blob (2.0.3) From ba7e7a6368f4e6097a7c6ee7145c5ff43e906517 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 09:21:05 +0200 Subject: [PATCH 04/11] chore(deps): update opentelemetry-ruby (non-major) (#30898) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Gemfile | 2 +- Gemfile.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 0d6cc4c4e1..d1a8c2c5a4 100644 --- a/Gemfile +++ b/Gemfile @@ -114,7 +114,7 @@ group :opentelemetry do gem 'opentelemetry-instrumentation-net_http', '~> 0.22.4', require: false gem 'opentelemetry-instrumentation-pg', '~> 0.27.1', require: false gem 'opentelemetry-instrumentation-rack', '~> 0.24.1', require: false - gem 'opentelemetry-instrumentation-rails', '~> 0.30.0', require: false + gem 'opentelemetry-instrumentation-rails', '~> 0.31.0', require: false gem 'opentelemetry-instrumentation-redis', '~> 0.25.3', require: false gem 'opentelemetry-instrumentation-sidekiq', '~> 0.25.2', require: false gem 'opentelemetry-sdk', '~> 1.4', require: false diff --git a/Gemfile.lock b/Gemfile.lock index d855c05f43..e66077ff03 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -525,7 +525,7 @@ GEM opentelemetry-instrumentation-active_record (0.7.2) opentelemetry-api (~> 1.0) opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-active_support (0.5.1) + opentelemetry-instrumentation-active_support (0.6.0) opentelemetry-api (~> 1.0) opentelemetry-instrumentation-base (~> 0.22.1) opentelemetry-instrumentation-base (0.22.3) @@ -556,14 +556,14 @@ GEM opentelemetry-instrumentation-rack (0.24.5) opentelemetry-api (~> 1.0) opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-rails (0.30.2) + opentelemetry-instrumentation-rails (0.31.0) opentelemetry-api (~> 1.0) opentelemetry-instrumentation-action_mailer (~> 0.1.0) opentelemetry-instrumentation-action_pack (~> 0.9.0) opentelemetry-instrumentation-action_view (~> 0.7.0) opentelemetry-instrumentation-active_job (~> 0.7.0) opentelemetry-instrumentation-active_record (~> 0.7.0) - opentelemetry-instrumentation-active_support (~> 0.5.0) + opentelemetry-instrumentation-active_support (~> 0.6.0) opentelemetry-instrumentation-base (~> 0.22.1) opentelemetry-instrumentation-redis (0.25.6) opentelemetry-api (~> 1.0) @@ -995,7 +995,7 @@ DEPENDENCIES opentelemetry-instrumentation-net_http (~> 0.22.4) opentelemetry-instrumentation-pg (~> 0.27.1) opentelemetry-instrumentation-rack (~> 0.24.1) - opentelemetry-instrumentation-rails (~> 0.30.0) + opentelemetry-instrumentation-rails (~> 0.31.0) opentelemetry-instrumentation-redis (~> 0.25.3) opentelemetry-instrumentation-sidekiq (~> 0.25.2) opentelemetry-sdk (~> 1.4) From dd85e3bcc5e04a11775cbdd9cb1f7d3577ddd9d7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 07:30:30 +0000 Subject: [PATCH 05/11] New Crowdin Translations (automated) (#30901) Co-authored-by: GitHub Actions --- app/javascript/mastodon/locales/uk.json | 5 +++++ config/locales/cs.yml | 2 +- config/locales/simple_form.cs.yml | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/javascript/mastodon/locales/uk.json b/app/javascript/mastodon/locales/uk.json index 338b650617..150b808f89 100644 --- a/app/javascript/mastodon/locales/uk.json +++ b/app/javascript/mastodon/locales/uk.json @@ -35,7 +35,9 @@ "account.follow_back": "Підписатися взаємно", "account.followers": "Підписники", "account.followers.empty": "Ніхто ще не підписаний на цього користувача.", + "account.followers_counter": "{count, plural, one {{counter} підписник} few {{counter} підписники} many {{counter} підписників} other {{counter} підписники}}", "account.following": "Ви стежите", + "account.following_counter": "{count, plural, one {{counter} підписка} few {{counter} підписки} many {{counter} підписок} other {{counter} підписки}}", "account.follows.empty": "Цей користувач ще ні на кого не підписався.", "account.go_to_profile": "Перейти до профілю", "account.hide_reblogs": "Сховати поширення від @{name}", @@ -61,6 +63,7 @@ "account.requested_follow": "{name} надсилає запит на стеження", "account.share": "Поділитися профілем @{name}", "account.show_reblogs": "Показати поширення від @{name}", + "account.statuses_counter": "{count, plural, one {{counter} допис} few {{counter} дописи} many {{counter} дописів} other {{counter} допис}}", "account.unblock": "Розблокувати @{name}", "account.unblock_domain": "Розблокувати {domain}", "account.unblock_short": "Розблокувати", @@ -412,6 +415,7 @@ "limited_account_hint.title": "Цей профіль сховали модератори {domain}.", "link_preview.author": "Від {name}", "link_preview.more_from_author": "Більше від {name}", + "link_preview.shares": "{count, plural, one {{counter} допис} few {{counter} дописи} many {{counter} дописів} other {{counter} допис}}", "lists.account.add": "Додати до списку", "lists.account.remove": "Вилучити зі списку", "lists.delete": "Видалити список", @@ -695,6 +699,7 @@ "server_banner.is_one_of_many": "{domain} - один з багатьох незалежних серверів Mastodon, які ви можете використати, щоб брати участь у федівері.", "server_banner.server_stats": "Статистика сервера:", "sign_in_banner.create_account": "Створити обліковий запис", + "sign_in_banner.follow_anyone": "Слідкуйте за ким завгодно у всьому fediverse і дивіться все це в хронологічному порядку. Немає алгоритмів, реклами чи наживок для натискань при перегляді.", "sign_in_banner.mastodon_is": "Мастодон - найкращий спосіб продовжувати свою справу.", "sign_in_banner.sign_in": "Увійти", "sign_in_banner.sso_redirect": "Увійдіть або зареєструйтесь", diff --git a/config/locales/cs.yml b/config/locales/cs.yml index f3b8f27d80..20e7e4d46b 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -81,7 +81,7 @@ cs: invite_request_text: Důvody založení invited_by: Pozván uživatelem ip: IP adresa - joined: Uživatel založen + joined: Uživatelem od location: all: Všechny local: Místní diff --git a/config/locales/simple_form.cs.yml b/config/locales/simple_form.cs.yml index 0b1a34e1b9..f8422102f1 100644 --- a/config/locales/simple_form.cs.yml +++ b/config/locales/simple_form.cs.yml @@ -59,7 +59,7 @@ cs: setting_display_media_default: Skrývat média označená jako citlivá setting_display_media_hide_all: Vždy skrývat média setting_display_media_show_all: Vždy zobrazovat média - setting_use_blurhash: Gradienty jsou založeny na barvách skryté grafiky, ale zakrývají jakékoliv detaily + setting_use_blurhash: Gradienty jsou vytvořeny na základě barvev skrytých médií, ale zakrývají veškeré detaily setting_use_pending_items: Aktualizovat časovou osu až po kliknutí namísto automatického rolování kanálu username: Pouze písmena, číslice a podtržítka whole_word: Je-li klíčové slovo či fráze pouze alfanumerická, bude aplikován pouze, pokud se shoduje s celým slovem From 5651c16d11a3bb35e44c260b0c18afcd451fd5aa Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Wed, 3 Jul 2024 03:47:40 -0400 Subject: [PATCH 06/11] Limit `browser` version to enforce ruby 3.1 support (#30766) --- Gemfile | 2 +- Gemfile.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index d1a8c2c5a4..769f834f46 100644 --- a/Gemfile +++ b/Gemfile @@ -25,7 +25,7 @@ gem 'ruby-vips', '~> 2.2', require: false gem 'active_model_serializers', '~> 0.10' gem 'addressable', '~> 2.8' gem 'bootsnap', '~> 1.18.0', require: false -gem 'browser' +gem 'browser', '< 6' # https://github.com/fnando/browser/issues/543 gem 'charlock_holmes', '~> 0.7.7' gem 'chewy', '~> 7.3' gem 'devise', '~> 4.9' diff --git a/Gemfile.lock b/Gemfile.lock index e66077ff03..aafad69ed7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -917,7 +917,7 @@ DEPENDENCIES blurhash (~> 0.1) bootsnap (~> 1.18.0) brakeman (~> 6.0) - browser + browser (< 6) bundler-audit (~> 0.9) capybara (~> 3.39) charlock_holmes (~> 0.7.7) From 1dbffc30f12d20f3c5f038c72b06967480f82129 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 08:04:38 +0000 Subject: [PATCH 07/11] chore(deps): update opentelemetry-ruby (non-major) (#30903) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index aafad69ed7..30835adef7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -516,7 +516,7 @@ GEM opentelemetry-api (~> 1.0) opentelemetry-instrumentation-active_support (~> 0.1) opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-active_job (0.7.1) + opentelemetry-instrumentation-active_job (0.7.2) opentelemetry-api (~> 1.0) opentelemetry-instrumentation-base (~> 0.22.1) opentelemetry-instrumentation-active_model_serializers (0.20.1) @@ -568,7 +568,7 @@ GEM opentelemetry-instrumentation-redis (0.25.6) opentelemetry-api (~> 1.0) opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-sidekiq (0.25.5) + opentelemetry-instrumentation-sidekiq (0.25.6) opentelemetry-api (~> 1.0) opentelemetry-instrumentation-base (~> 0.22.1) opentelemetry-registry (0.3.1) From 6270281037c1f0991bfbf8d195280be3f5733bf3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 08:05:19 +0000 Subject: [PATCH 08/11] chore(deps): update dependency doorkeeper to v5.7.1 (#30053) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 30835adef7..6444e46876 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -208,7 +208,7 @@ GEM activerecord (>= 4.2, < 8) docile (1.4.0) domain_name (0.6.20240107) - doorkeeper (5.6.9) + doorkeeper (5.7.1) railties (>= 5) dotenv (3.1.2) drb (2.2.1) @@ -431,7 +431,7 @@ GEM mime-types-data (3.2024.0604) mini_mime (1.1.5) mini_portile2 (2.8.7) - minitest (5.23.1) + minitest (5.24.1) msgpack (1.7.2) multi_json (1.15.0) multipart-post (2.4.0) From f99159d1eb671d72138edc42d11cd58472c33aec Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 10:46:51 +0200 Subject: [PATCH 09/11] fix(deps): update dependency webpack-merge to v6 (#30891) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 0379c7a5f5..404c4f486f 100644 --- a/package.json +++ b/package.json @@ -127,7 +127,7 @@ "webpack-assets-manifest": "^4.0.6", "webpack-bundle-analyzer": "^4.8.0", "webpack-cli": "^3.3.12", - "webpack-merge": "^5.9.0", + "webpack-merge": "^6.0.0", "wicg-inert": "^3.1.2", "workbox-expiration": "^7.0.0", "workbox-precaching": "^7.0.0", diff --git a/yarn.lock b/yarn.lock index 9d19cb837e..8e72138a15 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2901,7 +2901,7 @@ __metadata: webpack-bundle-analyzer: "npm:^4.8.0" webpack-cli: "npm:^3.3.12" webpack-dev-server: "npm:^3.11.3" - webpack-merge: "npm:^5.9.0" + webpack-merge: "npm:^6.0.0" wicg-inert: "npm:^3.1.2" workbox-expiration: "npm:^7.0.0" workbox-precaching: "npm:^7.0.0" @@ -17928,14 +17928,14 @@ __metadata: languageName: node linkType: hard -"webpack-merge@npm:^5.9.0": - version: 5.10.0 - resolution: "webpack-merge@npm:5.10.0" +"webpack-merge@npm:^6.0.0": + version: 6.0.1 + resolution: "webpack-merge@npm:6.0.1" dependencies: clone-deep: "npm:^4.0.1" flat: "npm:^5.0.2" - wildcard: "npm:^2.0.0" - checksum: 10c0/b607c84cabaf74689f965420051a55a08722d897bdd6c29cb0b2263b451c090f962d41ecf8c9bf56b0ab3de56e65476ace0a8ecda4f4a4663684243d90e0512b + wildcard: "npm:^2.0.1" + checksum: 10c0/bf1429567858b353641801b8a2696ca0aac270fc8c55d4de8a7b586fe07d27fdcfc83099a98ab47e6162383db8dd63bb8cc25b1beb2ec82150422eec843b0dc0 languageName: node linkType: hard @@ -18183,7 +18183,7 @@ __metadata: languageName: node linkType: hard -"wildcard@npm:^2.0.0": +"wildcard@npm:^2.0.1": version: 2.0.1 resolution: "wildcard@npm:2.0.1" checksum: 10c0/08f70cd97dd9a20aea280847a1fe8148e17cae7d231640e41eb26d2388697cbe65b67fd9e68715251c39b080c5ae4f76d71a9a69fa101d897273efdfb1b58bf7 From 20c749bd45286fbf0aca5610562e5dc6f2c616dd Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 11:14:15 +0200 Subject: [PATCH 10/11] chore(deps): update dependency rubocop-rspec to v3.0.2 (#30902) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6444e46876..ca36c8cf95 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -757,7 +757,7 @@ GEM rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rspec (3.0.1) + rubocop-rspec (3.0.2) rubocop (~> 1.61) rubocop-rspec_rails (2.30.0) rubocop (~> 1.61) From 9be77fc0dbb01c1a8a54cd3da97e16c7941df367 Mon Sep 17 00:00:00 2001 From: David Roetzel Date: Wed, 3 Jul 2024 15:36:42 +0200 Subject: [PATCH 11/11] Revert "Add system check for missing database indexes" (#30909) --- Gemfile | 1 - Gemfile.lock | 2 - app/lib/admin/db/schema_parser.rb | 92 ------------------- app/lib/admin/system_check.rb | 1 - .../system_check/missing_indexes_check.rb | 36 -------- config/locales/en.yml | 2 - spec/lib/admin/db/schema_parser_spec.rb | 49 ---------- .../missing_indexes_check_spec.rb | 65 ------------- 8 files changed, 248 deletions(-) delete mode 100644 app/lib/admin/db/schema_parser.rb delete mode 100644 app/lib/admin/system_check/missing_indexes_check.rb delete mode 100644 spec/lib/admin/db/schema_parser_spec.rb delete mode 100644 spec/lib/admin/system_check/missing_indexes_check_spec.rb diff --git a/Gemfile b/Gemfile index 769f834f46..ef52d50cac 100644 --- a/Gemfile +++ b/Gemfile @@ -229,4 +229,3 @@ gem 'rubyzip', '~> 2.3' gem 'hcaptcha', '~> 7.1' gem 'mail', '~> 2.8' -gem 'prism' diff --git a/Gemfile.lock b/Gemfile.lock index ca36c8cf95..eb6720e454 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -600,7 +600,6 @@ GEM actionmailer (>= 3) net-smtp premailer (~> 1.7, >= 1.7.9) - prism (0.30.0) propshaft (0.9.0) actionpack (>= 7.0.0) activesupport (>= 7.0.0) @@ -1004,7 +1003,6 @@ DEPENDENCIES pg (~> 1.5) pghero premailer-rails - prism propshaft public_suffix (~> 6.0) puma (~> 6.3) diff --git a/app/lib/admin/db/schema_parser.rb b/app/lib/admin/db/schema_parser.rb deleted file mode 100644 index e61a2281ee..0000000000 --- a/app/lib/admin/db/schema_parser.rb +++ /dev/null @@ -1,92 +0,0 @@ -# frozen_string_literal: true - -class Admin::Db::SchemaParser - class Index - attr_reader :name, :table_name, :columns, :options - - def initialize(name:, table_name:, columns:, options:) - @name = name - @table_name = table_name - @columns = columns - @options = options - end - end - - attr_reader :indexes_by_table - - def initialize(source) - parse(source) - end - - private - - def parse(source) - @indexes_by_table = {} - queue = [Prism.parse(source).value] - while (node = queue.shift) - if node.type == :call_node && node.name == :create_table - parse_create_table(node) - elsif node.type == :call_node && node.name == :add_index - parse_add_index(node) - else - queue.concat(node.compact_child_nodes) - end - end - end - - def parse_create_table(node) - table_name = parse_arguments(node).first - queue = node.compact_child_nodes - while (node = queue.shift) - if node.type == :call_node && node.name == :index - parse_index(node, table_name:) - else - queue.concat(node.compact_child_nodes) - end - end - end - - def parse_index(node, table_name:) - arguments = parse_arguments(node) - save_index( - name: arguments.last[:name], - table_name: table_name, - columns: arguments.first, - options: arguments.last - ) - end - - def parse_add_index(node) - arguments = parse_arguments(node) - save_index( - name: arguments.last[:name], - table_name: arguments.first, - columns: arguments[1], - options: arguments.last - ) - end - - def parse_arguments(node) - node.arguments.arguments.map { |a| parse_argument(a) } - end - - def parse_argument(argument) - case argument - when Prism::StringNode - argument.unescaped - when Prism::SymbolNode - argument.unescaped.to_sym - when Prism::ArrayNode - argument.elements.map { |e| parse_argument(e) } - when Prism::KeywordHashNode - argument.elements.to_h do |element| - [element.key.unescaped.to_sym, parse_argument(element.value)] - end - end - end - - def save_index(name:, table_name:, columns:, options:) - @indexes_by_table[table_name] ||= [] - @indexes_by_table[table_name] << Index.new(name:, table_name:, columns:, options:) - end -end diff --git a/app/lib/admin/system_check.rb b/app/lib/admin/system_check.rb index 453011f7a6..25c88341a4 100644 --- a/app/lib/admin/system_check.rb +++ b/app/lib/admin/system_check.rb @@ -8,7 +8,6 @@ class Admin::SystemCheck Admin::SystemCheck::SidekiqProcessCheck, Admin::SystemCheck::RulesCheck, Admin::SystemCheck::ElasticsearchCheck, - Admin::SystemCheck::MissingIndexesCheck, ].freeze def self.perform(current_user) diff --git a/app/lib/admin/system_check/missing_indexes_check.rb b/app/lib/admin/system_check/missing_indexes_check.rb deleted file mode 100644 index b7eecbb067..0000000000 --- a/app/lib/admin/system_check/missing_indexes_check.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -class Admin::SystemCheck::MissingIndexesCheck < Admin::SystemCheck::BaseCheck - def skip? - !current_user.can?(:view_devops) - end - - def pass? - missing_indexes.none? - end - - def message - Admin::SystemCheck::Message.new(:missing_indexes_check, missing_indexes.join(', ')) - end - - private - - def missing_indexes - @missing_indexes ||= begin - expected_indexes_by_table.flat_map do |table, indexes| - expected_indexes = indexes.map(&:name) - expected_indexes - existing_indexes_for(table) - end - end - end - - def expected_indexes_by_table - schema_rb = Rails.root.join('db', 'schema.rb').read - schema_parser = Admin::Db::SchemaParser.new(schema_rb) - schema_parser.indexes_by_table - end - - def existing_indexes_for(table) - ActiveRecord::Base.connection.indexes(table).map(&:name) - end -end diff --git a/config/locales/en.yml b/config/locales/en.yml index 270382dd11..20df80c272 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -862,8 +862,6 @@ en: elasticsearch_version_check: message_html: 'Incompatible Elasticsearch version: %{value}' version_comparison: Elasticsearch %{running_version} is running while %{required_version} is required - missing_indexes_check: - message_html: 'The following indexes are missing from the database and should be recreated: %{value}.
Missing indexes may lead to severely reduced performance and data inconsistencies.' rules_check: action: Manage server rules message_html: You haven't defined any server rules. diff --git a/spec/lib/admin/db/schema_parser_spec.rb b/spec/lib/admin/db/schema_parser_spec.rb deleted file mode 100644 index e28d5c1f97..0000000000 --- a/spec/lib/admin/db/schema_parser_spec.rb +++ /dev/null @@ -1,49 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -describe Admin::Db::SchemaParser do - let(:dummy_schema) do - <<~SCHEMA - # Comment - ActiveRecord::Schema[7.1].define(version: 23) do - create_table "people", force: :cascade do |t| - t.string "name" - end - - create_table "posts", force: :cascade do |t| - t.string "title", null: false - t.bigint "size", null: false - t.string "description" - # t.index ["size", "title"], name: "index_posts_on_size_and_title" - t.index ["title"], name: "index_posts_on_title", unique: true - t.index ["size"], name: "index_posts_on_size" - end - - # add_index "people", ["name"], name: "commented_out_index" - add_index "people", ["name"], name: "index_people_on_name" - end - SCHEMA - end - let(:schema_parser) { described_class.new(dummy_schema) } - - describe '#indexes_by_table' do - subject { schema_parser.indexes_by_table } - - it 'returns index info for all affected tables' do - expect(subject.keys).to match_array(%w(people posts)) - end - - it 'returns all index information for the `people` table' do - people_info = subject['people'] - expect(people_info.map(&:name)).to contain_exactly('index_people_on_name') - end - - it 'returns all index information for the `posts` table' do - posts_info = subject['posts'] - expect(posts_info.map(&:name)).to contain_exactly( - 'index_posts_on_title', 'index_posts_on_size' - ) - end - end -end diff --git a/spec/lib/admin/system_check/missing_indexes_check_spec.rb b/spec/lib/admin/system_check/missing_indexes_check_spec.rb deleted file mode 100644 index e183be5620..0000000000 --- a/spec/lib/admin/system_check/missing_indexes_check_spec.rb +++ /dev/null @@ -1,65 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -describe Admin::SystemCheck::MissingIndexesCheck do - subject(:check) { described_class.new(user) } - - let(:user) { Fabricate(:user) } - let(:schema_parser) do - instance_double(Admin::Db::SchemaParser, indexes_by_table: index_info) - end - let(:index_info) do - { - 'users' => [instance_double(Admin::Db::SchemaParser::Index, name: 'index_users_on_profile_id')], - 'posts' => [instance_double(Admin::Db::SchemaParser::Index, name: 'index_posts_on_user_id')], - } - end - let(:posts_indexes) { [] } - let(:users_indexes) { [] } - - before do - allow(Admin::Db::SchemaParser).to receive(:new).and_return(schema_parser) - allow(ActiveRecord::Base.connection).to receive(:indexes).with('posts').and_return(posts_indexes) - allow(ActiveRecord::Base.connection).to receive(:indexes).with('users').and_return(users_indexes) - end - - it_behaves_like 'a check available to devops users' - - describe '#pass?' do - context 'when indexes are missing' do - let(:posts_indexes) do - [instance_double(ActiveRecord::ConnectionAdapters::IndexDefinition, name: 'index_posts_on_user_id')] - end - - it 'returns false' do - expect(check.pass?).to be false - end - end - - context 'when all expected indexes are present' do - let(:posts_indexes) do - [instance_double(ActiveRecord::ConnectionAdapters::IndexDefinition, name: 'index_posts_on_user_id')] - end - let(:users_indexes) do - [instance_double(ActiveRecord::ConnectionAdapters::IndexDefinition, name: 'index_users_on_profile_id')] - end - - it 'returns true' do - expect(check.pass?).to be true - end - end - end - - describe '#message' do - subject { check.message } - - it 'sets the class name as the message key' do - expect(subject.key).to eq(:missing_indexes_check) - end - - it 'sets a list of missing indexes as message value' do - expect(subject.value).to eq('index_users_on_profile_id, index_posts_on_user_id') - end - end -end