From ca66e61b933b97a74f1f79b820a2fa3bd5ffc5f2 Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 23 May 2023 15:17:09 +0200 Subject: [PATCH 01/17] Add support for custom sign-up URLs (#25014) --- app/helpers/application_helper.rb | 2 +- .../mastodon/features/interaction_modal/index.jsx | 6 ++++-- .../mastodon/features/ui/components/header.jsx | 11 ++++++++--- .../features/ui/components/sign_in_banner.jsx | 8 +++++--- app/serializers/rest/instance_serializer.rb | 1 + 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 19d297725e..cdd5927c40 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -52,7 +52,7 @@ module ApplicationHelper if closed_registrations? || omniauth_only? 'https://joinmastodon.org/#getting-started' else - new_user_registration_path + ENV.fetch('SSO_ACCOUNT_SIGN_UP', new_user_registration_path) end end diff --git a/app/javascript/mastodon/features/interaction_modal/index.jsx b/app/javascript/mastodon/features/interaction_modal/index.jsx index 0f3b36122b..b1ff72b0ef 100644 --- a/app/javascript/mastodon/features/interaction_modal/index.jsx +++ b/app/javascript/mastodon/features/interaction_modal/index.jsx @@ -9,6 +9,7 @@ import { openModal, closeModal } from 'mastodon/actions/modal'; const mapStateToProps = (state, { accountId }) => ({ displayNameHtml: state.getIn(['accounts', accountId, 'display_name_html']), + signupUrl: state.getIn(['server', 'server', 'registrations', 'url'], '/auth/sign_up'), }); const mapDispatchToProps = (dispatch) => ({ @@ -81,6 +82,7 @@ class InteractionModal extends PureComponent { url: PropTypes.string, type: PropTypes.oneOf(['reply', 'reblog', 'favourite', 'follow']), onSignupClick: PropTypes.func.isRequired, + signupUrl: PropTypes.string.isRequired, }; handleSignupClick = () => { @@ -88,7 +90,7 @@ class InteractionModal extends PureComponent { }; render () { - const { url, type, displayNameHtml } = this.props; + const { url, type, displayNameHtml, signupUrl } = this.props; const name = ; @@ -121,7 +123,7 @@ class InteractionModal extends PureComponent { if (registrationsOpen) { signupButton = ( - + ); diff --git a/app/javascript/mastodon/features/ui/components/header.jsx b/app/javascript/mastodon/features/ui/components/header.jsx index 79b43ecb60..c73626865c 100644 --- a/app/javascript/mastodon/features/ui/components/header.jsx +++ b/app/javascript/mastodon/features/ui/components/header.jsx @@ -16,6 +16,10 @@ const Account = connect(state => ({ )); +const mapStateToProps = (state) => ({ + signupUrl: state.getIn(['server', 'server', 'registrations', 'url'], '/auth/sign_up'), +}); + const mapDispatchToProps = (dispatch) => ({ openClosedRegistrationsModal() { dispatch(openModal('CLOSED_REGISTRATIONS')); @@ -31,11 +35,12 @@ class Header extends PureComponent { static propTypes = { openClosedRegistrationsModal: PropTypes.func, location: PropTypes.object, + signupUrl: PropTypes.string.isRequired, }; render () { const { signedIn } = this.context.identity; - const { location, openClosedRegistrationsModal } = this.props; + const { location, openClosedRegistrationsModal, signupUrl } = this.props; let content; @@ -51,7 +56,7 @@ class Header extends PureComponent { if (registrationsOpen) { signupButton = ( - + ); @@ -87,4 +92,4 @@ class Header extends PureComponent { } -export default withRouter(connect(null, mapDispatchToProps)(Header)); +export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Header)); diff --git a/app/javascript/mastodon/features/ui/components/sign_in_banner.jsx b/app/javascript/mastodon/features/ui/components/sign_in_banner.jsx index 984a574e56..53aefd34cc 100644 --- a/app/javascript/mastodon/features/ui/components/sign_in_banner.jsx +++ b/app/javascript/mastodon/features/ui/components/sign_in_banner.jsx @@ -1,11 +1,11 @@ import { useCallback } from 'react'; import { FormattedMessage } from 'react-intl'; -import { useDispatch } from 'react-redux'; +import { useAppDispatch, useAppSelector } from 'mastodon/store'; import { registrationsOpen } from 'mastodon/initial_state'; import { openModal } from 'mastodon/actions/modal'; const SignInBanner = () => { - const dispatch = useDispatch(); + const dispatch = useAppDispatch(); const openClosedRegistrationsModal = useCallback( () => dispatch(openModal('CLOSED_REGISTRATIONS')), @@ -14,9 +14,11 @@ const SignInBanner = () => { let signupButton; + const signupUrl = useAppSelector((state) => state.getIn(['server', 'server', 'registrations', 'url'], '/auth/sign_up')); + if (registrationsOpen) { signupButton = ( - + ); diff --git a/app/serializers/rest/instance_serializer.rb b/app/serializers/rest/instance_serializer.rb index a07840f0ca..14aeda9462 100644 --- a/app/serializers/rest/instance_serializer.rb +++ b/app/serializers/rest/instance_serializer.rb @@ -85,6 +85,7 @@ class REST::InstanceSerializer < ActiveModel::Serializer enabled: registrations_enabled?, approval_required: Setting.registrations_mode == 'approved', message: registrations_enabled? ? nil : registrations_message, + url: ENV.fetch('SSO_ACCOUNT_SIGN_UP', nil), } end From c9f980b26812ec737f81ee9c56b70241c8a372ad Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 23 May 2023 09:44:11 -0400 Subject: [PATCH 02/17] Add request spec for backups download (#25099) --- spec/requests/backups_spec.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 spec/requests/backups_spec.rb diff --git a/spec/requests/backups_spec.rb b/spec/requests/backups_spec.rb new file mode 100644 index 0000000000..a6c2efe0db --- /dev/null +++ b/spec/requests/backups_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe 'Backups' do + include RoutingHelper + + describe 'GET backups#download' do + let(:user) { Fabricate(:user) } + let(:backup) { Fabricate(:backup, user: user) } + + before do + sign_in user + end + + it 'Downloads a user backup' do + get download_backup_path(backup) + + expect(response).to redirect_to(backup_dump_url) + end + + def backup_dump_url + full_asset_url(backup.dump.url) + end + end +end From b6b4ea4ca5bdf3c92abbaf4ed3fe82587a0233f1 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 23 May 2023 10:08:26 -0400 Subject: [PATCH 03/17] Move the mastodon/*_cli files to mastodon/cli/* (#24139) --- .rubocop.yml | 18 +++-- .rubocop_todo.yml | 16 ++--- bin/tootctl | 4 +- .../{accounts_cli.rb => cli/accounts.rb} | 12 ++-- lib/mastodon/{cache_cli.rb => cli/cache.rb} | 12 ++-- .../canonical_email_blocks.rb} | 12 ++-- .../{domains_cli.rb => cli/domains.rb} | 12 ++-- .../email_domain_blocks.rb} | 12 ++-- lib/mastodon/{emoji_cli.rb => cli/emoji.rb} | 10 +-- lib/mastodon/{feeds_cli.rb => cli/feeds.rb} | 12 ++-- lib/mastodon/{cli_helper.rb => cli/helper.rb} | 4 +- .../{ip_blocks_cli.rb => cli/ip_blocks.rb} | 10 +-- lib/{cli.rb => mastodon/cli/main.rb} | 66 +++++++++---------- .../maintenance.rb} | 12 ++-- lib/mastodon/{media_cli.rb => cli/media.rb} | 12 ++-- .../preview_cards.rb} | 12 ++-- lib/mastodon/{search_cli.rb => cli/search.rb} | 12 ++-- .../{settings_cli.rb => cli/settings.rb} | 14 ++-- .../{statuses_cli.rb => cli/statuses.rb} | 12 ++-- .../{upgrade_cli.rb => cli/upgrade.rb} | 12 ++-- .../ip_blocks_spec.rb} | 4 +- .../{cli_spec.rb => cli/main_spec.rb} | 4 +- .../settings_spec.rb} | 6 +- 23 files changed, 149 insertions(+), 151 deletions(-) rename lib/mastodon/{accounts_cli.rb => cli/accounts.rb} (99%) rename lib/mastodon/{cache_cli.rb => cli/cache.rb} (91%) rename lib/mastodon/{canonical_email_blocks_cli.rb => cli/canonical_email_blocks.rb} (86%) rename lib/mastodon/{domains_cli.rb => cli/domains.rb} (98%) rename lib/mastodon/{email_domain_blocks_cli.rb => cli/email_domain_blocks.rb} (94%) rename lib/mastodon/{emoji_cli.rb => cli/emoji.rb} (96%) rename lib/mastodon/{feeds_cli.rb => cli/feeds.rb} (90%) rename lib/mastodon/{cli_helper.rb => cli/helper.rb} (98%) rename lib/mastodon/{ip_blocks_cli.rb => cli/ip_blocks.rb} (96%) rename lib/{cli.rb => mastodon/cli/main.rb} (75%) rename lib/mastodon/{maintenance_cli.rb => cli/maintenance.rb} (99%) rename lib/mastodon/{media_cli.rb => cli/media.rb} (98%) rename lib/mastodon/{preview_cards_cli.rb => cli/preview_cards.rb} (90%) rename lib/mastodon/{search_cli.rb => cli/search.rb} (95%) rename lib/mastodon/{settings_cli.rb => cli/settings.rb} (80%) rename lib/mastodon/{statuses_cli.rb => cli/statuses.rb} (98%) rename lib/mastodon/{upgrade_cli.rb => cli/upgrade.rb} (96%) rename spec/lib/mastodon/{ip_blocks_cli_spec.rb => cli/ip_blocks_spec.rb} (99%) rename spec/lib/mastodon/{cli_spec.rb => cli/main_spec.rb} (81%) rename spec/lib/mastodon/{settings_cli_spec.rb => cli/settings_spec.rb} (92%) diff --git a/.rubocop.yml b/.rubocop.yml index 46cf0275f8..4eef9d63e6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -43,7 +43,7 @@ Layout/LineLength: - !ruby/regexp / \# .*$/ - !ruby/regexp /^\# .*$/ Exclude: - - lib/**/*cli*.rb + - 'lib/mastodon/cli/*.rb' - db/*migrate/**/* - db/seeds/**/* @@ -57,7 +57,7 @@ Lint/UselessAccessModifier: # https://docs.rubocop.org/rubocop/cops_metrics.html#metricsabcsize Metrics/AbcSize: Exclude: - - 'lib/**/*cli*.rb' + - 'lib/mastodon/cli/*.rb' - db/*migrate/**/* # Reason: Some functions cannot be broken up, but others may be refactor candidates @@ -66,7 +66,7 @@ Metrics/BlockLength: CountAsOne: ['array', 'hash', 'heredoc', 'method_call'] Exclude: - 'config/routes.rb' - - 'lib/mastodon/*_cli.rb' + - 'lib/mastodon/cli/*.rb' - 'lib/tasks/*.rake' - 'app/models/concerns/account_associations.rb' - 'app/models/concerns/account_interactions.rb' @@ -95,14 +95,14 @@ Metrics/BlockLength: # https://docs.rubocop.org/rubocop/cops_metrics.html#metricsblocknesting Metrics/BlockNesting: Exclude: - - 'lib/mastodon/*_cli.rb' + - 'lib/mastodon/cli/*.rb' # Reason: Some Excluded files would be candidates for refactoring but not currently addressed # https://docs.rubocop.org/rubocop/cops_metrics.html#metricsclasslength Metrics/ClassLength: CountAsOne: ['array', 'hash', 'heredoc', 'method_call'] Exclude: - - 'lib/mastodon/*_cli.rb' + - 'lib/mastodon/cli/*.rb' - 'app/controllers/admin/accounts_controller.rb' - 'app/controllers/api/base_controller.rb' - 'app/controllers/api/v1/admin/accounts_controller.rb' @@ -146,7 +146,7 @@ Metrics/ClassLength: # https://docs.rubocop.org/rubocop/cops_metrics.html#metricscyclomaticcomplexity Metrics/CyclomaticComplexity: Exclude: - - lib/mastodon/*cli*.rb + - lib/mastodon/cli/*.rb - db/*migrate/**/* # Reason: Currently disabled in .rubocop_todo.yml @@ -154,7 +154,7 @@ Metrics/CyclomaticComplexity: Metrics/MethodLength: CountAsOne: [array, heredoc] Exclude: - - 'lib/mastodon/*_cli.rb' + - 'lib/mastodon/cli/*.rb' # Reason: # https://docs.rubocop.org/rubocop/cops_metrics.html#metricsmodulelength @@ -176,9 +176,7 @@ Rails/HttpStatus: Rails/Exit: Exclude: - 'config/boot.rb' - - 'lib/mastodon/*_cli.rb' - - 'lib/mastodon/cli_helper.rb' - - 'lib/cli.rb' + - 'lib/mastodon/cli/*.rb' # Reason: Some single letter camel case files shouldn't be split # https://docs.rubocop.org/rubocop-rspec/cops_rspec.html#rspecfilepath diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 22412a053d..94439ce479 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -846,9 +846,9 @@ Rails/SkipsModelValidations: - 'db/post_migrate/20220617202502_migrate_roles.rb' - 'db/post_migrate/20221101190723_backfill_admin_action_logs.rb' - 'db/post_migrate/20221206114142_backfill_admin_action_logs_again.rb' - - 'lib/cli.rb' - - 'lib/mastodon/accounts_cli.rb' - - 'lib/mastodon/maintenance_cli.rb' + - 'lib/mastodon/cli/accounts.rb' + - 'lib/mastodon/cli/main.rb' + - 'lib/mastodon/cli/maintenance.rb' - 'spec/controllers/api/v1/admin/accounts_controller_spec.rb' - 'spec/lib/activitypub/activity/follow_spec.rb' - 'spec/services/follow_service_spec.rb' @@ -929,7 +929,7 @@ Rails/WhereExists: - 'app/validators/vote_validator.rb' - 'app/workers/move_worker.rb' - 'db/migrate/20190529143559_preserve_old_layout_for_existing_users.rb' - - 'lib/mastodon/email_domain_blocks_cli.rb' + - 'lib/mastodon/cli/email_domain_blocks.rb' - 'lib/tasks/tests.rake' - 'spec/controllers/api/v1/accounts/notes_controller_spec.rb' - 'spec/controllers/api/v1/tags_controller_spec.rb' @@ -991,7 +991,7 @@ Style/FormatStringToken: Exclude: - 'app/models/privacy_policy.rb' - 'config/initializers/devise.rb' - - 'lib/mastodon/maintenance_cli.rb' + - 'lib/mastodon/cli/maintenance.rb' - 'lib/paperclip/color_extractor.rb' # This cop supports unsafe autocorrection (--autocorrect-all). @@ -1436,9 +1436,9 @@ Style/GuardClause: - 'db/post_migrate/20220704024901_migrate_settings_to_user_roles.rb' - 'lib/devise/two_factor_ldap_authenticatable.rb' - 'lib/devise/two_factor_pam_authenticatable.rb' - - 'lib/mastodon/accounts_cli.rb' - - 'lib/mastodon/maintenance_cli.rb' - - 'lib/mastodon/media_cli.rb' + - 'lib/mastodon/cli/accounts.rb' + - 'lib/mastodon/cli/maintenance.rb' + - 'lib/mastodon/cli/media.rb' - 'lib/paperclip/attachment_extensions.rb' - 'lib/tasks/repo.rake' diff --git a/bin/tootctl b/bin/tootctl index 9c7ae8b871..b3311c6b2a 100755 --- a/bin/tootctl +++ b/bin/tootctl @@ -2,11 +2,11 @@ APP_PATH = File.expand_path('../config/application', __dir__) require_relative '../config/boot' -require_relative '../lib/cli' +require_relative '../lib/mastodon/cli/main' begin Chewy.strategy(:mastodon) do - Mastodon::CLI.start(ARGV) + Mastodon::CLI::Main.start(ARGV) end rescue Interrupt exit(130) diff --git a/lib/mastodon/accounts_cli.rb b/lib/mastodon/cli/accounts.rb similarity index 99% rename from lib/mastodon/accounts_cli.rb rename to lib/mastodon/cli/accounts.rb index c09577c9ef..a44f63db03 100644 --- a/lib/mastodon/accounts_cli.rb +++ b/lib/mastodon/cli/accounts.rb @@ -1,13 +1,13 @@ # frozen_string_literal: true require 'set' -require_relative '../../config/boot' -require_relative '../../config/environment' -require_relative 'cli_helper' +require_relative '../../../config/boot' +require_relative '../../../config/environment' +require_relative 'helper' -module Mastodon - class AccountsCLI < Thor - include CLIHelper +module Mastodon::CLI + class Accounts < Thor + include Helper def self.exit_on_failure? true diff --git a/lib/mastodon/cache_cli.rb b/lib/mastodon/cli/cache.rb similarity index 91% rename from lib/mastodon/cache_cli.rb rename to lib/mastodon/cli/cache.rb index 803404c34f..b0bf6aabd8 100644 --- a/lib/mastodon/cache_cli.rb +++ b/lib/mastodon/cli/cache.rb @@ -1,12 +1,12 @@ # frozen_string_literal: true -require_relative '../../config/boot' -require_relative '../../config/environment' -require_relative 'cli_helper' +require_relative '../../../config/boot' +require_relative '../../../config/environment' +require_relative 'helper' -module Mastodon - class CacheCLI < Thor - include CLIHelper +module Mastodon::CLI + class Cache < Thor + include Helper def self.exit_on_failure? true diff --git a/lib/mastodon/canonical_email_blocks_cli.rb b/lib/mastodon/cli/canonical_email_blocks.rb similarity index 86% rename from lib/mastodon/canonical_email_blocks_cli.rb rename to lib/mastodon/cli/canonical_email_blocks.rb index ec228d466a..f3c427a2c7 100644 --- a/lib/mastodon/canonical_email_blocks_cli.rb +++ b/lib/mastodon/cli/canonical_email_blocks.rb @@ -1,13 +1,13 @@ # frozen_string_literal: true require 'concurrent' -require_relative '../../config/boot' -require_relative '../../config/environment' -require_relative 'cli_helper' +require_relative '../../../config/boot' +require_relative '../../../config/environment' +require_relative 'helper' -module Mastodon - class CanonicalEmailBlocksCLI < Thor - include CLIHelper +module Mastodon::CLI + class CanonicalEmailBlocks < Thor + include Helper def self.exit_on_failure? true diff --git a/lib/mastodon/domains_cli.rb b/lib/mastodon/cli/domains.rb similarity index 98% rename from lib/mastodon/domains_cli.rb rename to lib/mastodon/cli/domains.rb index 05f08f4623..8b5f03ce0f 100644 --- a/lib/mastodon/domains_cli.rb +++ b/lib/mastodon/cli/domains.rb @@ -1,13 +1,13 @@ # frozen_string_literal: true require 'concurrent' -require_relative '../../config/boot' -require_relative '../../config/environment' -require_relative 'cli_helper' +require_relative '../../../config/boot' +require_relative '../../../config/environment' +require_relative 'helper' -module Mastodon - class DomainsCLI < Thor - include CLIHelper +module Mastodon::CLI + class Domains < Thor + include Helper def self.exit_on_failure? true diff --git a/lib/mastodon/email_domain_blocks_cli.rb b/lib/mastodon/cli/email_domain_blocks.rb similarity index 94% rename from lib/mastodon/email_domain_blocks_cli.rb rename to lib/mastodon/cli/email_domain_blocks.rb index f39f470691..6ef35cc8cf 100644 --- a/lib/mastodon/email_domain_blocks_cli.rb +++ b/lib/mastodon/cli/email_domain_blocks.rb @@ -1,13 +1,13 @@ # frozen_string_literal: true require 'concurrent' -require_relative '../../config/boot' -require_relative '../../config/environment' -require_relative 'cli_helper' +require_relative '../../../config/boot' +require_relative '../../../config/environment' +require_relative 'helper' -module Mastodon - class EmailDomainBlocksCLI < Thor - include CLIHelper +module Mastodon::CLI + class EmailDomainBlocks < Thor + include Helper def self.exit_on_failure? true diff --git a/lib/mastodon/emoji_cli.rb b/lib/mastodon/cli/emoji.rb similarity index 96% rename from lib/mastodon/emoji_cli.rb rename to lib/mastodon/cli/emoji.rb index 8f2432a3e2..9b41a59c29 100644 --- a/lib/mastodon/emoji_cli.rb +++ b/lib/mastodon/cli/emoji.rb @@ -1,12 +1,12 @@ # frozen_string_literal: true require 'rubygems/package' -require_relative '../../config/boot' -require_relative '../../config/environment' -require_relative 'cli_helper' +require_relative '../../../config/boot' +require_relative '../../../config/environment' +require_relative 'helper' -module Mastodon - class EmojiCLI < Thor +module Mastodon::CLI + class Emoji < Thor def self.exit_on_failure? true end diff --git a/lib/mastodon/feeds_cli.rb b/lib/mastodon/cli/feeds.rb similarity index 90% rename from lib/mastodon/feeds_cli.rb rename to lib/mastodon/cli/feeds.rb index fcfb487404..4307b880f7 100644 --- a/lib/mastodon/feeds_cli.rb +++ b/lib/mastodon/cli/feeds.rb @@ -1,12 +1,12 @@ # frozen_string_literal: true -require_relative '../../config/boot' -require_relative '../../config/environment' -require_relative 'cli_helper' +require_relative '../../../config/boot' +require_relative '../../../config/environment' +require_relative 'helper' -module Mastodon - class FeedsCLI < Thor - include CLIHelper +module Mastodon::CLI + class Feeds < Thor + include Helper include Redisable def self.exit_on_failure? diff --git a/lib/mastodon/cli_helper.rb b/lib/mastodon/cli/helper.rb similarity index 98% rename from lib/mastodon/cli_helper.rb rename to lib/mastodon/cli/helper.rb index ab1351ae80..b277e16ebd 100644 --- a/lib/mastodon/cli_helper.rb +++ b/lib/mastodon/cli/helper.rb @@ -9,8 +9,8 @@ HttpLog.configuration.logger = dev_null Paperclip.options[:log] = false Chewy.logger = dev_null -module Mastodon - module CLIHelper +module Mastodon::CLI + module Helper def dry_run? options[:dry_run] end diff --git a/lib/mastodon/ip_blocks_cli.rb b/lib/mastodon/cli/ip_blocks.rb similarity index 96% rename from lib/mastodon/ip_blocks_cli.rb rename to lib/mastodon/cli/ip_blocks.rb index 82a08753bc..561d64d182 100644 --- a/lib/mastodon/ip_blocks_cli.rb +++ b/lib/mastodon/cli/ip_blocks.rb @@ -1,12 +1,12 @@ # frozen_string_literal: true require 'rubygems/package' -require_relative '../../config/boot' -require_relative '../../config/environment' -require_relative 'cli_helper' +require_relative '../../../config/boot' +require_relative '../../../config/environment' +require_relative 'helper' -module Mastodon - class IpBlocksCLI < Thor +module Mastodon::CLI + class IpBlocks < Thor def self.exit_on_failure? true end diff --git a/lib/cli.rb b/lib/mastodon/cli/main.rb similarity index 75% rename from lib/cli.rb rename to lib/mastodon/cli/main.rb index ac235cf039..0f2236f78f 100644 --- a/lib/cli.rb +++ b/lib/mastodon/cli/main.rb @@ -1,73 +1,73 @@ # frozen_string_literal: true require 'thor' -require_relative 'mastodon/media_cli' -require_relative 'mastodon/emoji_cli' -require_relative 'mastodon/accounts_cli' -require_relative 'mastodon/feeds_cli' -require_relative 'mastodon/search_cli' -require_relative 'mastodon/settings_cli' -require_relative 'mastodon/statuses_cli' -require_relative 'mastodon/domains_cli' -require_relative 'mastodon/preview_cards_cli' -require_relative 'mastodon/cache_cli' -require_relative 'mastodon/upgrade_cli' -require_relative 'mastodon/email_domain_blocks_cli' -require_relative 'mastodon/canonical_email_blocks_cli' -require_relative 'mastodon/ip_blocks_cli' -require_relative 'mastodon/maintenance_cli' -require_relative 'mastodon/version' +require_relative 'media' +require_relative 'emoji' +require_relative 'accounts' +require_relative 'feeds' +require_relative 'search' +require_relative 'settings' +require_relative 'statuses' +require_relative 'domains' +require_relative 'preview_cards' +require_relative 'cache' +require_relative 'upgrade' +require_relative 'email_domain_blocks' +require_relative 'canonical_email_blocks' +require_relative 'ip_blocks' +require_relative 'maintenance' +require_relative '../version' -module Mastodon - class CLI < Thor +module Mastodon::CLI + class Main < Thor def self.exit_on_failure? true end desc 'media SUBCOMMAND ...ARGS', 'Manage media files' - subcommand 'media', Mastodon::MediaCLI + subcommand 'media', Media desc 'emoji SUBCOMMAND ...ARGS', 'Manage custom emoji' - subcommand 'emoji', Mastodon::EmojiCLI + subcommand 'emoji', Emoji desc 'accounts SUBCOMMAND ...ARGS', 'Manage accounts' - subcommand 'accounts', Mastodon::AccountsCLI + subcommand 'accounts', Accounts desc 'feeds SUBCOMMAND ...ARGS', 'Manage feeds' - subcommand 'feeds', Mastodon::FeedsCLI + subcommand 'feeds', Feeds desc 'search SUBCOMMAND ...ARGS', 'Manage the search engine' - subcommand 'search', Mastodon::SearchCLI + subcommand 'search', Search desc 'settings SUBCOMMAND ...ARGS', 'Manage dynamic settings' - subcommand 'settings', Mastodon::SettingsCLI + subcommand 'settings', Settings desc 'statuses SUBCOMMAND ...ARGS', 'Manage statuses' - subcommand 'statuses', Mastodon::StatusesCLI + subcommand 'statuses', Statuses desc 'domains SUBCOMMAND ...ARGS', 'Manage account domains' - subcommand 'domains', Mastodon::DomainsCLI + subcommand 'domains', Domains desc 'preview_cards SUBCOMMAND ...ARGS', 'Manage preview cards' - subcommand 'preview_cards', Mastodon::PreviewCardsCLI + subcommand 'preview_cards', PreviewCards desc 'cache SUBCOMMAND ...ARGS', 'Manage cache' - subcommand 'cache', Mastodon::CacheCLI + subcommand 'cache', Cache desc 'upgrade SUBCOMMAND ...ARGS', 'Various version upgrade utilities' - subcommand 'upgrade', Mastodon::UpgradeCLI + subcommand 'upgrade', Upgrade desc 'email_domain_blocks SUBCOMMAND ...ARGS', 'Manage e-mail domain blocks' - subcommand 'email_domain_blocks', Mastodon::EmailDomainBlocksCLI + subcommand 'email_domain_blocks', EmailDomainBlocks desc 'ip_blocks SUBCOMMAND ...ARGS', 'Manage IP blocks' - subcommand 'ip_blocks', Mastodon::IpBlocksCLI + subcommand 'ip_blocks', IpBlocks desc 'canonical_email_blocks SUBCOMMAND ...ARGS', 'Manage canonical e-mail blocks' - subcommand 'canonical_email_blocks', Mastodon::CanonicalEmailBlocksCLI + subcommand 'canonical_email_blocks', CanonicalEmailBlocks desc 'maintenance SUBCOMMAND ...ARGS', 'Various maintenance utilities' - subcommand 'maintenance', Mastodon::MaintenanceCLI + subcommand 'maintenance', Maintenance option :dry_run, type: :boolean desc 'self-destruct', 'Erase the server from the federation' diff --git a/lib/mastodon/maintenance_cli.rb b/lib/mastodon/cli/maintenance.rb similarity index 99% rename from lib/mastodon/maintenance_cli.rb rename to lib/mastodon/cli/maintenance.rb index 88bd191ea9..d9f1b02570 100644 --- a/lib/mastodon/maintenance_cli.rb +++ b/lib/mastodon/cli/maintenance.rb @@ -1,13 +1,13 @@ # frozen_string_literal: true require 'tty-prompt' -require_relative '../../config/boot' -require_relative '../../config/environment' -require_relative 'cli_helper' +require_relative '../../../config/boot' +require_relative '../../../config/environment' +require_relative 'helper' -module Mastodon - class MaintenanceCLI < Thor - include CLIHelper +module Mastodon::CLI + class Maintenance < Thor + include Helper def self.exit_on_failure? true diff --git a/lib/mastodon/media_cli.rb b/lib/mastodon/cli/media.rb similarity index 98% rename from lib/mastodon/media_cli.rb rename to lib/mastodon/cli/media.rb index 1bedcd9beb..509c4ca264 100644 --- a/lib/mastodon/media_cli.rb +++ b/lib/mastodon/cli/media.rb @@ -1,13 +1,13 @@ # frozen_string_literal: true -require_relative '../../config/boot' -require_relative '../../config/environment' -require_relative 'cli_helper' +require_relative '../../../config/boot' +require_relative '../../../config/environment' +require_relative 'helper' -module Mastodon - class MediaCLI < Thor +module Mastodon::CLI + class Media < Thor include ActionView::Helpers::NumberHelper - include CLIHelper + include Helper VALID_PATH_SEGMENTS_SIZE = [7, 10].freeze diff --git a/lib/mastodon/preview_cards_cli.rb b/lib/mastodon/cli/preview_cards.rb similarity index 90% rename from lib/mastodon/preview_cards_cli.rb rename to lib/mastodon/cli/preview_cards.rb index cf4407250c..794b25693a 100644 --- a/lib/mastodon/preview_cards_cli.rb +++ b/lib/mastodon/cli/preview_cards.rb @@ -1,14 +1,14 @@ # frozen_string_literal: true require 'tty-prompt' -require_relative '../../config/boot' -require_relative '../../config/environment' -require_relative 'cli_helper' +require_relative '../../../config/boot' +require_relative '../../../config/environment' +require_relative 'helper' -module Mastodon - class PreviewCardsCLI < Thor +module Mastodon::CLI + class PreviewCards < Thor include ActionView::Helpers::NumberHelper - include CLIHelper + include Helper def self.exit_on_failure? true diff --git a/lib/mastodon/search_cli.rb b/lib/mastodon/cli/search.rb similarity index 95% rename from lib/mastodon/search_cli.rb rename to lib/mastodon/cli/search.rb index 31e9a3d5af..ccece5b5f8 100644 --- a/lib/mastodon/search_cli.rb +++ b/lib/mastodon/cli/search.rb @@ -1,12 +1,12 @@ # frozen_string_literal: true -require_relative '../../config/boot' -require_relative '../../config/environment' -require_relative 'cli_helper' +require_relative '../../../config/boot' +require_relative '../../../config/environment' +require_relative 'helper' -module Mastodon - class SearchCLI < Thor - include CLIHelper +module Mastodon::CLI + class Search < Thor + include Helper # Indices are sorted by amount of data to be expected in each, so that # smaller indices can go online sooner diff --git a/lib/mastodon/settings_cli.rb b/lib/mastodon/cli/settings.rb similarity index 80% rename from lib/mastodon/settings_cli.rb rename to lib/mastodon/cli/settings.rb index 488c655dee..5869efc466 100644 --- a/lib/mastodon/settings_cli.rb +++ b/lib/mastodon/cli/settings.rb @@ -1,11 +1,11 @@ # frozen_string_literal: true -require_relative '../../config/boot' -require_relative '../../config/environment' -require_relative 'cli_helper' +require_relative '../../../config/boot' +require_relative '../../../config/environment' +require_relative 'helper' -module Mastodon - class RegistrationsCLI < Thor +module Mastodon::CLI + class Registrations < Thor def self.exit_on_failure? true end @@ -37,8 +37,8 @@ module Mastodon end end - class SettingsCLI < Thor + class Settings < Thor desc 'registrations SUBCOMMAND ...ARGS', 'Manage state of registrations' - subcommand 'registrations', RegistrationsCLI + subcommand 'registrations', Registrations end end diff --git a/lib/mastodon/statuses_cli.rb b/lib/mastodon/cli/statuses.rb similarity index 98% rename from lib/mastodon/statuses_cli.rb rename to lib/mastodon/cli/statuses.rb index baab83e297..e5eb759608 100644 --- a/lib/mastodon/statuses_cli.rb +++ b/lib/mastodon/cli/statuses.rb @@ -1,12 +1,12 @@ # frozen_string_literal: true -require_relative '../../config/boot' -require_relative '../../config/environment' -require_relative 'cli_helper' +require_relative '../../../config/boot' +require_relative '../../../config/environment' +require_relative 'helper' -module Mastodon - class StatusesCLI < Thor - include CLIHelper +module Mastodon::CLI + class Statuses < Thor + include Helper include ActionView::Helpers::NumberHelper def self.exit_on_failure? diff --git a/lib/mastodon/upgrade_cli.rb b/lib/mastodon/cli/upgrade.rb similarity index 96% rename from lib/mastodon/upgrade_cli.rb rename to lib/mastodon/cli/upgrade.rb index 2b60f9eee5..f20fa4cdf4 100644 --- a/lib/mastodon/upgrade_cli.rb +++ b/lib/mastodon/cli/upgrade.rb @@ -1,12 +1,12 @@ # frozen_string_literal: true -require_relative '../../config/boot' -require_relative '../../config/environment' -require_relative 'cli_helper' +require_relative '../../../config/boot' +require_relative '../../../config/environment' +require_relative 'helper' -module Mastodon - class UpgradeCLI < Thor - include CLIHelper +module Mastodon::CLI + class Upgrade < Thor + include Helper def self.exit_on_failure? true diff --git a/spec/lib/mastodon/ip_blocks_cli_spec.rb b/spec/lib/mastodon/cli/ip_blocks_spec.rb similarity index 99% rename from spec/lib/mastodon/ip_blocks_cli_spec.rb rename to spec/lib/mastodon/cli/ip_blocks_spec.rb index 27c005772b..e7639d9aaf 100644 --- a/spec/lib/mastodon/ip_blocks_cli_spec.rb +++ b/spec/lib/mastodon/cli/ip_blocks_spec.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true require 'rails_helper' -require 'mastodon/ip_blocks_cli' +require 'mastodon/cli/ip_blocks' -RSpec.describe Mastodon::IpBlocksCLI do +RSpec.describe Mastodon::CLI::IpBlocks do let(:cli) { described_class.new } describe '#add' do diff --git a/spec/lib/mastodon/cli_spec.rb b/spec/lib/mastodon/cli/main_spec.rb similarity index 81% rename from spec/lib/mastodon/cli_spec.rb rename to spec/lib/mastodon/cli/main_spec.rb index 419f8b864e..105c4ec371 100644 --- a/spec/lib/mastodon/cli_spec.rb +++ b/spec/lib/mastodon/cli/main_spec.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true require 'rails_helper' -require 'cli' +require 'mastodon/cli/main' -describe Mastodon::CLI do +describe Mastodon::CLI::Main do describe 'version' do it 'returns the Mastodon version' do expect { described_class.new.invoke(:version) }.to output( diff --git a/spec/lib/mastodon/settings_cli_spec.rb b/spec/lib/mastodon/cli/settings_spec.rb similarity index 92% rename from spec/lib/mastodon/settings_cli_spec.rb rename to spec/lib/mastodon/cli/settings_spec.rb index 713cb7e437..01f0775628 100644 --- a/spec/lib/mastodon/settings_cli_spec.rb +++ b/spec/lib/mastodon/cli/settings_spec.rb @@ -1,11 +1,11 @@ # frozen_string_literal: true require 'rails_helper' -require 'mastodon/settings_cli' +require 'mastodon/cli/settings' -RSpec.describe Mastodon::SettingsCLI do +RSpec.describe Mastodon::CLI::Settings do describe 'subcommand "registrations"' do - let(:cli) { Mastodon::RegistrationsCLI.new } + let(:cli) { Mastodon::CLI::Registrations.new } before do Setting.registrations_mode = nil From 778e4a7bf73b196a6a98bd839b7fd9c44de3d6f7 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 23 May 2023 10:40:21 -0400 Subject: [PATCH 04/17] Fix RSpec/ExpectInHook cop (#25100) --- .rubocop_todo.yml | 6 ------ spec/controllers/api/v1/media_controller_spec.rb | 8 ++------ .../settings/applications_controller_spec.rb | 4 +--- spec/lib/status_filter_spec.rb | 16 ++++++++-------- 4 files changed, 11 insertions(+), 23 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 94439ce479..effe4cae56 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -393,12 +393,6 @@ RSpec/ExpectChange: - 'spec/services/unsuspend_account_service_spec.rb' - 'spec/workers/scheduler/accounts_statuses_cleanup_scheduler_spec.rb' -RSpec/ExpectInHook: - Exclude: - - 'spec/controllers/api/v1/media_controller_spec.rb' - - 'spec/controllers/settings/applications_controller_spec.rb' - - 'spec/lib/status_filter_spec.rb' - # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: implicit, each, example diff --git a/spec/controllers/api/v1/media_controller_spec.rb b/spec/controllers/api/v1/media_controller_spec.rb index 20d58e8c03..79a9d1474a 100644 --- a/spec/controllers/api/v1/media_controller_spec.rb +++ b/spec/controllers/api/v1/media_controller_spec.rb @@ -15,23 +15,19 @@ RSpec.describe Api::V1::MediaController do describe 'POST #create' do describe 'with paperclip errors' do context 'when imagemagick cant identify the file type' do - before do + it 'returns http 422' do expect_any_instance_of(Account).to receive_message_chain(:media_attachments, :create!).and_raise(Paperclip::Errors::NotIdentifiedByImageMagickError) post :create, params: { file: fixture_file_upload('attachment.jpg', 'image/jpeg') } - end - it 'returns http 422' do expect(response).to have_http_status(422) end end context 'when there is a generic error' do - before do + it 'returns http 422' do expect_any_instance_of(Account).to receive_message_chain(:media_attachments, :create!).and_raise(Paperclip::Error) post :create, params: { file: fixture_file_upload('attachment.jpg', 'image/jpeg') } - end - it 'returns http 422' do expect(response).to have_http_status(500) end end diff --git a/spec/controllers/settings/applications_controller_spec.rb b/spec/controllers/settings/applications_controller_spec.rb index c0a57380e8..169304b3ed 100644 --- a/spec/controllers/settings/applications_controller_spec.rb +++ b/spec/controllers/settings/applications_controller_spec.rb @@ -182,12 +182,10 @@ describe Settings::ApplicationsController do describe 'regenerate' do let(:token) { user.token_for_app(app) } - before do + it 'creates new token' do expect(token).to_not be_nil post :regenerate, params: { id: app.id } - end - it 'creates new token' do expect(user.token_for_app(app)).to_not eql(token) end end diff --git a/spec/lib/status_filter_spec.rb b/spec/lib/status_filter_spec.rb index 08519bc590..98e2ef913a 100644 --- a/spec/lib/status_filter_spec.rb +++ b/spec/lib/status_filter_spec.rb @@ -7,7 +7,7 @@ describe StatusFilter do let(:status) { Fabricate(:status) } context 'without an account' do - subject { described_class.new(status, nil) } + subject(:filter) { described_class.new(status, nil) } context 'when there are no connections' do it { is_expected.to_not be_filtered } @@ -22,16 +22,16 @@ describe StatusFilter do end context 'when status policy does not allow show' do - before do + it 'filters the status' do expect_any_instance_of(StatusPolicy).to receive(:show?).and_return(false) - end - it { is_expected.to be_filtered } + expect(filter).to be_filtered + end end end context 'with real account' do - subject { described_class.new(status, account) } + subject(:filter) { described_class.new(status, account) } let(:account) { Fabricate(:account) } @@ -73,11 +73,11 @@ describe StatusFilter do end context 'when status policy does not allow show' do - before do + it 'filters the status' do expect_any_instance_of(StatusPolicy).to receive(:show?).and_return(false) - end - it { is_expected.to be_filtered } + expect(filter).to be_filtered + end end end end From b896b16cb3c8626fbee12a7eda7f882114b1a040 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 23 May 2023 10:49:11 -0400 Subject: [PATCH 05/17] Fix RSpec/PredicateMatcher cop (#25102) --- .rubocop_todo.yml | 9 --------- .../api/v1/accounts/notes_controller_spec.rb | 2 +- spec/models/user_spec.rb | 14 +++++++------- spec/services/post_status_service_spec.rb | 2 +- 4 files changed, 9 insertions(+), 18 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index effe4cae56..2e9f6c429f 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -556,15 +556,6 @@ RSpec/PendingWithoutReason: Exclude: - 'spec/models/account_spec.rb' -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: Strict, EnforcedStyle, AllowedExplicitMatchers. -# SupportedStyles: inflected, explicit -RSpec/PredicateMatcher: - Exclude: - - 'spec/controllers/api/v1/accounts/notes_controller_spec.rb' - - 'spec/models/user_spec.rb' - - 'spec/services/post_status_service_spec.rb' - RSpec/StubbedMock: Exclude: - 'spec/controllers/api/base_controller_spec.rb' diff --git a/spec/controllers/api/v1/accounts/notes_controller_spec.rb b/spec/controllers/api/v1/accounts/notes_controller_spec.rb index fd4d34f691..4107105afd 100644 --- a/spec/controllers/api/v1/accounts/notes_controller_spec.rb +++ b/spec/controllers/api/v1/accounts/notes_controller_spec.rb @@ -43,7 +43,7 @@ describe Api::V1::Accounts::NotesController do it 'does not create account note' do subject - expect(AccountNote.where(account_id: user.account.id, target_account_id: account.id).exists?).to be_falsey + expect(AccountNote.where(account_id: user.account.id, target_account_id: account.id)).to_not exist end end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index ae46f0ae45..d3e0ac63a4 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -115,19 +115,19 @@ RSpec.describe User do it 'allows a non-blacklisted user to be created' do user = User.new(email: 'foo@example.com', account: account, password: password, agreement: true) - expect(user.valid?).to be_truthy + expect(user).to be_valid end it 'does not allow a blacklisted user to be created' do user = User.new(email: 'foo@mvrht.com', account: account, password: password, agreement: true) - expect(user.valid?).to be_falsey + expect(user).to_not be_valid end it 'does not allow a subdomain blacklisted user to be created' do user = User.new(email: 'foo@mvrht.com.topdomain.tld', account: account, password: password, agreement: true) - expect(user.valid?).to be_falsey + expect(user).to_not be_valid end end @@ -350,17 +350,17 @@ RSpec.describe User do it 'does not allow a user to be created unless they are whitelisted' do user = User.new(email: 'foo@example.com', account: account, password: password, agreement: true) - expect(user.valid?).to be_falsey + expect(user).to_not be_valid end it 'allows a user to be created if they are whitelisted' do user = User.new(email: 'foo@mastodon.space', account: account, password: password, agreement: true) - expect(user.valid?).to be_truthy + expect(user).to be_valid end it 'does not allow a user with a whitelisted top domain as subdomain in their email address to be created' do user = User.new(email: 'foo@mastodon.space.userdomain.com', account: account, password: password, agreement: true) - expect(user.valid?).to be_falsey + expect(user).to_not be_valid end context do @@ -374,7 +374,7 @@ RSpec.describe User do Rails.configuration.x.email_domains_blacklist = 'blacklisted.mastodon.space' user = User.new(email: 'foo@blacklisted.mastodon.space', account: account, password: password) - expect(user.valid?).to be_falsey + expect(user).to_not be_valid end end end diff --git a/spec/services/post_status_service_spec.rb b/spec/services/post_status_service_spec.rb index 33153c3d07..f577122710 100644 --- a/spec/services/post_status_service_spec.rb +++ b/spec/services/post_status_service_spec.rb @@ -48,7 +48,7 @@ RSpec.describe PostStatusService, type: :service do expect(status.params['text']).to eq 'Hi future!' expect(status.params['media_ids']).to eq [media.id] expect(media.reload.status).to be_nil - expect(Status.where(text: 'Hi future!').exists?).to be_falsey + expect(Status.where(text: 'Hi future!')).to_not exist end it 'does not change statuses count' do From d27216dc4616d80659c0cc5d2a55394e0e1ae874 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 23 May 2023 17:15:17 +0200 Subject: [PATCH 06/17] Enforce import order with ESLint (#25096) --- .eslintrc.js | 98 +++++++++---------- app/javascript/mastodon/actions/accounts.js | 1 + .../mastodon/actions/announcements.js | 1 + app/javascript/mastodon/actions/blocks.js | 1 + app/javascript/mastodon/actions/bookmarks.js | 1 + app/javascript/mastodon/actions/compose.js | 5 +- .../mastodon/actions/conversations.js | 1 + app/javascript/mastodon/actions/directory.js | 3 +- app/javascript/mastodon/actions/favourites.js | 1 + app/javascript/mastodon/actions/filters.js | 1 + app/javascript/mastodon/actions/history.js | 1 + .../mastodon/actions/importer/normalizer.js | 3 +- .../mastodon/actions/interactions.js | 1 + app/javascript/mastodon/actions/lists.js | 3 +- app/javascript/mastodon/actions/markers.js | 8 +- app/javascript/mastodon/actions/mutes.js | 1 + .../mastodon/actions/notifications.js | 18 ++-- .../mastodon/actions/pin_statuses.js | 4 +- app/javascript/mastodon/actions/polls.js | 1 + .../actions/push_notifications/index.js | 2 +- .../actions/push_notifications/registerer.js | 7 +- app/javascript/mastodon/actions/reports.js | 1 + app/javascript/mastodon/actions/search.js | 1 + app/javascript/mastodon/actions/server.js | 1 + app/javascript/mastodon/actions/settings.js | 4 +- app/javascript/mastodon/actions/statuses.js | 4 +- app/javascript/mastodon/actions/store.js | 1 + app/javascript/mastodon/actions/streaming.js | 21 ++-- .../mastodon/actions/suggestions.js | 3 +- app/javascript/mastodon/actions/timelines.js | 8 +- app/javascript/mastodon/actions/trends.js | 1 + app/javascript/mastodon/api.js | 1 + .../__tests__/autosuggest_emoji-test.jsx | 1 + .../components/__tests__/avatar-test.jsx | 4 +- .../__tests__/avatar_overlay-test.jsx | 4 +- .../components/__tests__/button-test.jsx | 1 + .../__tests__/display_name-test.jsx | 4 +- .../mastodon/components/account.jsx | 26 +++-- .../mastodon/components/admin/Counter.jsx | 10 +- .../mastodon/components/admin/Dimension.jsx | 8 +- .../components/admin/ReportReasonSelector.jsx | 7 +- .../mastodon/components/admin/Retention.jsx | 7 +- .../mastodon/components/admin/Trends.jsx | 7 +- .../mastodon/components/attachment_list.jsx | 8 +- .../mastodon/components/autosuggest_emoji.jsx | 6 +- .../components/autosuggest_hashtag.jsx | 6 +- .../mastodon/components/autosuggest_input.jsx | 12 ++- .../components/autosuggest_textarea.jsx | 15 ++- .../mastodon/components/avatar_composite.jsx | 5 +- app/javascript/mastodon/components/button.jsx | 3 +- app/javascript/mastodon/components/column.jsx | 4 +- .../components/column_back_button.jsx | 8 +- .../components/column_back_button_slim.jsx | 4 +- .../mastodon/components/column_header.jsx | 7 +- .../components/dismissable_banner.jsx | 7 +- .../mastodon/components/dropdown_menu.jsx | 15 ++- .../containers/dropdown_menu_container.js | 1 + .../components/edited_timestamp/index.jsx | 12 ++- .../mastodon/components/error_boundary.jsx | 10 +- .../mastodon/components/hashtag.jsx | 15 ++- .../mastodon/components/inline_account.jsx | 4 +- .../intersection_observer_article.jsx | 5 +- .../mastodon/components/load_gap.jsx | 4 +- .../mastodon/components/load_more.jsx | 5 +- .../mastodon/components/load_pending.jsx | 5 +- .../mastodon/components/media_attachments.jsx | 7 +- .../mastodon/components/media_gallery.jsx | 17 +++- .../mastodon/components/modal_root.jsx | 5 +- .../mastodon/components/navigation_portal.jsx | 6 +- .../picture_in_picture_placeholder.jsx | 11 ++- app/javascript/mastodon/components/poll.jsx | 18 ++-- .../components/regeneration_indicator.jsx | 1 + .../mastodon/components/scrollable_list.jsx | 24 +++-- .../mastodon/components/server_banner.jsx | 8 +- .../mastodon/components/short_number.jsx | 7 +- app/javascript/mastodon/components/status.jsx | 32 +++--- .../mastodon/components/status_action_bar.jsx | 18 ++-- .../mastodon/components/status_content.jsx | 14 ++- .../mastodon/components/status_list.jsx | 13 ++- .../mastodon/containers/account_container.jsx | 8 +- .../mastodon/containers/admin_component.jsx | 4 +- .../mastodon/containers/compose_container.jsx | 15 +-- .../mastodon/containers/domain_container.jsx | 8 +- .../containers/dropdown_menu_container.js | 8 +- ...intersection_observer_article_container.js | 3 +- .../mastodon/containers/mastodon.jsx | 13 ++- .../mastodon/containers/media_container.jsx | 17 ++-- .../mastodon/containers/poll_container.js | 3 +- .../mastodon/containers/status_container.jsx | 44 +++++---- .../mastodon/features/about/index.jsx | 26 ++--- .../account/components/account_note.jsx | 11 ++- .../account/components/featured_tags.jsx | 5 +- .../components/follow_request_note.jsx | 4 +- .../features/account/components/header.jsx | 23 +++-- .../containers/account_note_container.js | 2 + .../containers/featured_tags_container.js | 8 +- .../follow_request_note_container.js | 4 +- .../mastodon/features/account/navigation.jsx | 4 +- .../account_gallery/components/media_item.jsx | 11 ++- .../features/account_gallery/index.jsx | 35 ++++--- .../account_timeline/components/header.jsx | 13 ++- .../components/limited_account_hint.jsx | 9 +- .../components/moved_note.jsx | 7 +- .../containers/header_container.jsx | 19 ++-- .../features/account_timeline/index.jsx | 37 ++++--- .../mastodon/features/audio/index.jsx | 21 ++-- .../mastodon/features/blocks/index.jsx | 22 +++-- .../features/bookmarked_statuses/index.jsx | 9 +- .../closed_registrations_modal/index.jsx | 6 +- .../components/column_settings.jsx | 7 +- .../containers/column_settings_container.js | 5 +- .../features/community_timeline/index.jsx | 26 +++-- .../compose/components/action_bar.jsx | 9 +- .../components/autosuggest_account.jsx | 5 +- .../compose/components/character_counter.jsx | 3 +- .../compose/components/compose_form.jsx | 37 ++++--- .../components/emoji_picker_dropdown.jsx | 14 ++- .../compose/components/language_dropdown.jsx | 15 ++- .../compose/components/navigation_bar.jsx | 15 ++- .../compose/components/poll_button.jsx | 6 +- .../features/compose/components/poll_form.jsx | 14 ++- .../compose/components/privacy_dropdown.jsx | 13 ++- .../compose/components/reply_indicator.jsx | 12 ++- .../features/compose/components/search.jsx | 12 ++- .../compose/components/search_results.jsx | 14 ++- .../compose/components/text_icon_button.jsx | 2 +- .../features/compose/components/upload.jsx | 13 ++- .../compose/components/upload_button.jsx | 9 +- .../compose/components/upload_form.jsx | 5 +- .../compose/components/upload_progress.jsx | 12 ++- .../features/compose/components/warning.jsx | 6 +- .../autosuggest_account_container.js | 3 +- .../containers/compose_form_container.js | 3 +- .../emoji_picker_dropdown_container.js | 9 +- .../containers/language_dropdown_container.js | 8 +- .../containers/navigation_container.js | 9 +- .../containers/poll_button_container.js | 3 +- .../compose/containers/poll_form_container.js | 3 +- .../containers/privacy_dropdown_container.js | 3 +- .../containers/reply_indicator_container.js | 1 + .../compose/containers/search_container.js | 2 + .../containers/search_results_container.js | 6 +- .../containers/sensitive_button_container.jsx | 12 ++- .../containers/spoiler_button_container.js | 8 +- .../containers/upload_button_container.js | 3 +- .../compose/containers/upload_container.js | 3 +- .../containers/upload_form_container.js | 1 + .../containers/upload_progress_container.js | 1 + .../compose/containers/warning_container.jsx | 8 +- .../mastodon/features/compose/index.jsx | 33 ++++--- .../features/compose/util/url_regex.js | 2 +- .../components/conversation.jsx | 17 ++-- .../components/conversations_list.jsx | 7 +- .../containers/conversation_container.js | 11 ++- .../conversations_list_container.js | 3 +- .../features/direct_timeline/index.jsx | 7 +- .../directory/components/account_card.jsx | 26 ++--- .../mastodon/features/directory/index.jsx | 25 +++-- .../mastodon/features/domain_blocks/index.jsx | 27 ++--- .../emoji/__tests__/emoji_index-test.js | 3 +- .../mastodon/features/emoji/emoji.js | 9 +- .../features/emoji/emoji_compressed.js | 9 +- .../features/emoji/emoji_mart_data_light.js | 2 +- .../mastodon/features/emoji/emoji_picker.js | 2 +- .../emoji/emoji_unicode_mapping_light.js | 1 - .../features/explore/components/story.jsx | 6 +- .../mastodon/features/explore/index.jsx | 23 +++-- .../mastodon/features/explore/links.jsx | 16 +-- .../mastodon/features/explore/results.jsx | 20 ++-- .../mastodon/features/explore/statuses.jsx | 12 ++- .../mastodon/features/explore/suggestions.jsx | 15 +-- .../mastodon/features/explore/tags.jsx | 13 ++- .../features/favourited_statuses/index.jsx | 9 +- .../mastodon/features/favourites/index.jsx | 12 ++- .../features/filters/added_to_filter.jsx | 11 ++- .../features/filters/select_filter.jsx | 12 ++- .../components/account_authorize.jsx | 10 +- .../containers/account_authorize_container.js | 3 +- .../features/follow_requests/index.jsx | 20 ++-- .../mastodon/features/followed_tags/index.jsx | 17 ++-- .../mastodon/features/followers/index.jsx | 27 ++--- .../mastodon/features/following/index.jsx | 27 ++--- .../components/announcements.jsx | 27 ++--- .../getting_started/components/trends.jsx | 10 +- .../containers/announcements_container.js | 10 +- .../containers/trends_container.js | 2 + .../features/getting_started/index.jsx | 26 +++-- .../components/column_settings.jsx | 12 ++- .../containers/column_settings_container.js | 3 +- .../features/hashtag_timeline/index.jsx | 33 ++++--- .../components/column_settings.jsx | 7 +- .../containers/column_settings_container.js | 3 +- .../mastodon/features/home_timeline/index.jsx | 30 +++--- .../features/interaction_modal/index.jsx | 12 ++- .../features/keyboard_shortcuts/index.jsx | 12 ++- .../list_adder/components/account.jsx | 10 +- .../features/list_adder/components/list.jsx | 14 ++- .../mastodon/features/list_adder/index.jsx | 16 +-- .../list_editor/components/account.jsx | 13 ++- .../list_editor/components/edit_list_form.jsx | 9 +- .../list_editor/components/search.jsx | 11 ++- .../mastodon/features/list_editor/index.jsx | 21 ++-- .../mastodon/features/list_timeline/index.jsx | 10 +- .../lists/components/new_list_form.jsx | 9 +- .../mastodon/features/lists/index.jsx | 11 ++- .../mastodon/features/mutes/index.jsx | 27 ++--- .../components/clear_column_button.jsx | 4 +- .../components/column_settings.jsx | 10 +- .../notifications/components/filter_bar.jsx | 4 +- .../components/follow_request.jsx | 12 ++- .../components/grant_permission_button.jsx | 3 +- .../notifications/components/notification.jsx | 29 +++--- .../notifications_permission_banner.jsx | 15 +-- .../notifications/components/report.jsx | 5 +- .../components/setting_toggle.jsx | 4 +- .../containers/column_settings_container.js | 12 ++- .../containers/filter_bar_container.js | 3 +- .../containers/follow_request_container.js | 6 +- .../containers/notification_container.js | 5 +- .../mastodon/features/notifications/index.jsx | 43 ++++---- .../components/progress_indicator.jsx | 6 +- .../features/onboarding/components/step.jsx | 3 +- .../mastodon/features/onboarding/follows.jsx | 18 ++-- .../mastodon/features/onboarding/index.jsx | 30 +++--- .../mastodon/features/onboarding/share.jsx | 22 +++-- .../picture_in_picture/components/footer.jsx | 20 ++-- .../picture_in_picture/components/header.jsx | 14 ++- .../features/picture_in_picture/index.jsx | 13 ++- .../features/pinned_statuses/index.jsx | 14 ++- .../features/privacy_policy/index.jsx | 9 +- .../components/column_settings.jsx | 7 +- .../containers/column_settings_container.js | 5 +- .../features/public_timeline/index.jsx | 24 +++-- .../mastodon/features/reblogs/index.jsx | 23 +++-- .../mastodon/features/report/category.jsx | 10 +- .../mastodon/features/report/comment.jsx | 7 +- .../features/report/components/option.jsx | 4 +- .../report/components/status_check_box.jsx | 16 +-- .../containers/status_check_box_container.js | 4 +- .../mastodon/features/report/rules.jsx | 8 +- .../mastodon/features/report/statuses.jsx | 11 ++- .../mastodon/features/report/thanks.jsx | 9 +- .../features/standalone/compose/index.jsx | 3 +- .../features/status/components/action_bar.jsx | 17 ++-- .../features/status/components/card.jsx | 15 ++- .../status/components/detailed_status.jsx | 34 ++++--- .../containers/detailed_status_container.js | 20 ++-- .../mastodon/features/status/index.jsx | 97 +++++++++--------- .../subscribed_languages_modal/index.jsx | 17 ++-- .../ui/components/__tests__/column-test.jsx | 1 + .../features/ui/components/actions_modal.jsx | 5 +- .../features/ui/components/audio_modal.jsx | 8 +- .../features/ui/components/block_modal.jsx | 18 ++-- .../features/ui/components/boost_modal.jsx | 27 ++--- .../features/ui/components/bundle.jsx | 2 +- .../ui/components/bundle_column_error.jsx | 11 ++- .../ui/components/bundle_modal_error.jsx | 3 +- .../features/ui/components/column.jsx | 9 +- .../features/ui/components/column_header.jsx | 4 +- .../features/ui/components/column_link.jsx | 6 +- .../features/ui/components/column_loading.jsx | 3 +- .../features/ui/components/columns_area.jsx | 16 +-- .../ui/components/compare_history_modal.jsx | 16 +-- .../features/ui/components/compose_panel.jsx | 13 ++- .../ui/components/confirmation_modal.jsx | 4 +- .../ui/components/disabled_account_banner.jsx | 12 ++- .../features/ui/components/embed_modal.jsx | 5 +- .../features/ui/components/filter_modal.jsx | 11 ++- .../ui/components/focal_point_modal.jsx | 38 ++++--- .../follow_requests_column_link.jsx | 15 +-- .../features/ui/components/header.jsx | 16 +-- .../features/ui/components/image_loader.jsx | 5 +- .../features/ui/components/image_modal.jsx | 8 +- .../features/ui/components/link_footer.jsx | 12 ++- .../features/ui/components/list_panel.jsx | 8 +- .../features/ui/components/media_modal.jsx | 26 +++-- .../features/ui/components/modal_root.jsx | 32 +++--- .../features/ui/components/mute_modal.jsx | 12 ++- .../ui/components/navigation_panel.jsx | 8 +- .../components/notifications_counter_icon.js | 1 + .../features/ui/components/report_modal.jsx | 19 ++-- .../features/ui/components/sign_in_banner.jsx | 7 +- .../features/ui/components/upload_area.jsx | 9 +- .../features/ui/components/video_modal.jsx | 10 +- .../features/ui/components/zoomable_image.jsx | 6 +- .../ui/containers/bundle_container.js | 3 +- .../ui/containers/columns_area_container.js | 1 + .../ui/containers/loading_bar_container.js | 1 + .../features/ui/containers/modal_container.js | 1 + .../ui/containers/notifications_container.js | 3 + .../ui/containers/status_list_container.js | 8 +- app/javascript/mastodon/features/ui/index.jsx | 47 +++++---- .../features/ui/util/optional_motion.js | 6 +- .../features/ui/util/react_router_helpers.jsx | 7 +- .../features/ui/util/reduced_motion.jsx | 5 +- .../mastodon/features/video/index.jsx | 18 ++-- app/javascript/mastodon/main.jsx | 5 +- app/javascript/mastodon/reducers/accounts.js | 5 +- .../mastodon/reducers/accounts_counters.js | 6 +- .../mastodon/reducers/accounts_map.js | 5 +- app/javascript/mastodon/reducers/alerts.js | 3 +- .../mastodon/reducers/announcements.js | 3 +- app/javascript/mastodon/reducers/compose.js | 9 +- app/javascript/mastodon/reducers/contexts.js | 3 +- .../mastodon/reducers/conversations.js | 6 +- .../mastodon/reducers/custom_emojis.js | 3 +- .../mastodon/reducers/domain_lists.js | 3 +- .../mastodon/reducers/dropdown_menu.js | 1 + app/javascript/mastodon/reducers/filters.js | 5 +- .../mastodon/reducers/followed_tags.js | 3 +- .../mastodon/reducers/height_cache.js | 1 + app/javascript/mastodon/reducers/history.js | 3 +- .../mastodon/reducers/list_adder.js | 1 + .../mastodon/reducers/list_editor.js | 1 + app/javascript/mastodon/reducers/lists.js | 3 +- app/javascript/mastodon/reducers/markers.js | 3 +- .../mastodon/reducers/media_attachments.js | 3 +- app/javascript/mastodon/reducers/meta.js | 5 +- app/javascript/mastodon/reducers/modal.js | 5 +- .../mastodon/reducers/notifications.js | 32 +++--- .../mastodon/reducers/picture_in_picture.js | 1 + app/javascript/mastodon/reducers/polls.js | 3 +- .../mastodon/reducers/push_notifications.js | 5 +- .../mastodon/reducers/relationships.js | 12 ++- app/javascript/mastodon/reducers/search.js | 13 +-- app/javascript/mastodon/reducers/server.js | 3 +- app/javascript/mastodon/reducers/settings.js | 9 +- .../mastodon/reducers/status_lists.js | 43 ++++---- app/javascript/mastodon/reducers/statuses.js | 5 +- .../mastodon/reducers/suggestions.js | 9 +- app/javascript/mastodon/reducers/tags.js | 3 +- app/javascript/mastodon/reducers/timelines.js | 13 +-- app/javascript/mastodon/reducers/trends.js | 3 +- .../mastodon/reducers/user_lists.js | 42 ++++---- app/javascript/mastodon/selectors/index.js | 4 +- .../mastodon/service_worker/entry.js | 1 + .../service_worker/web_push_notifications.js | 2 + app/javascript/packs/admin.jsx | 6 +- app/javascript/packs/application.js | 2 +- app/javascript/packs/public.jsx | 29 +++--- app/javascript/packs/share.jsx | 9 +- app/javascript/packs/sign_up.js | 3 +- .../packs/two_factor_authentication.js | 3 +- config/webpack/configuration.js | 3 +- config/webpack/development.js | 3 +- config/webpack/generateLocalePacks.js | 3 +- config/webpack/production.js | 8 +- config/webpack/rules/babel.js | 1 + config/webpack/rules/file.js | 1 + config/webpack/rules/index.js | 2 +- config/webpack/rules/node_modules.js | 1 + config/webpack/shared.js | 8 +- config/webpack/tests.js | 1 + config/webpack/translationRunner.js | 2 + streaming/index.js | 13 +-- 355 files changed, 2304 insertions(+), 1366 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 7741093674..2b0907b1d5 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -198,6 +198,55 @@ module.exports = { 'import/no-useless-path-segments': 'error', 'import/no-webpack-loader-syntax': 'error', + 'import/order': [ + 'error', + { + alphabetize: { order: 'asc' }, + 'newlines-between': 'always', + groups: [ + 'builtin', + 'external', + 'internal', + 'parent', + ['index', 'sibling'], + 'object', + ], + pathGroups: [ + // React core packages + { + pattern: '{react,react-dom,react-dom/client,prop-types}', + group: 'builtin', + position: 'after', + }, + // I18n + { + pattern: '{react-intl,intl-messageformat}', + group: 'builtin', + position: 'after', + }, + // Common React utilities + { + pattern: '{classnames,react-helmet,react-router-dom}', + group: 'external', + position: 'before', + }, + // Immutable / Redux / data store + { + pattern: '{immutable,react-redux,react-immutable-proptypes,react-immutable-pure-component,reselect}', + group: 'external', + position: 'before', + }, + // Internal packages + { + pattern: '{mastodon/**}', + group: 'internal', + position: 'after', + }, + ], + pathGroupsExcludedImportTypes: [], + }, + ], + 'promise/always-return': 'off', 'promise/catch-or-return': [ 'error', @@ -286,55 +335,6 @@ module.exports = { rules: { 'import/consistent-type-specifier-style': ['error', 'prefer-top-level'], - 'import/order': [ - 'error', - { - alphabetize: { order: 'asc' }, - 'newlines-between': 'always', - groups: [ - 'builtin', - 'external', - 'internal', - 'parent', - ['index', 'sibling'], - 'object', - ], - pathGroups: [ - // React core packages - { - pattern: '{react,react-dom,prop-types}', - group: 'builtin', - position: 'after', - }, - // I18n - { - pattern: 'react-intl', - group: 'builtin', - position: 'after', - }, - // Common React utilities - { - pattern: '{classnames,react-helmet}', - group: 'external', - position: 'before', - }, - // Immutable / Redux / data store - { - pattern: '{immutable,react-redux,react-immutable-proptypes,react-immutable-pure-component,reselect}', - group: 'external', - position: 'before', - }, - // Internal packages - { - pattern: '{mastodon/**}', - group: 'internal', - position: 'after', - }, - ], - pathGroupsExcludedImportTypes: [], - }, - ], - '@typescript-eslint/consistent-type-definitions': ['warn', 'interface'], '@typescript-eslint/consistent-type-exports': 'error', '@typescript-eslint/consistent-type-imports': 'error', diff --git a/app/javascript/mastodon/actions/accounts.js b/app/javascript/mastodon/actions/accounts.js index 88407ae6cf..3a85393d6c 100644 --- a/app/javascript/mastodon/actions/accounts.js +++ b/app/javascript/mastodon/actions/accounts.js @@ -1,4 +1,5 @@ import api, { getLinks } from '../api'; + import { importFetchedAccount, importFetchedAccounts } from './importer'; export const ACCOUNT_FETCH_REQUEST = 'ACCOUNT_FETCH_REQUEST'; diff --git a/app/javascript/mastodon/actions/announcements.js b/app/javascript/mastodon/actions/announcements.js index 586dcfd337..339c5f3adc 100644 --- a/app/javascript/mastodon/actions/announcements.js +++ b/app/javascript/mastodon/actions/announcements.js @@ -1,4 +1,5 @@ import api from '../api'; + import { normalizeAnnouncement } from './importer/normalizer'; export const ANNOUNCEMENTS_FETCH_REQUEST = 'ANNOUNCEMENTS_FETCH_REQUEST'; diff --git a/app/javascript/mastodon/actions/blocks.js b/app/javascript/mastodon/actions/blocks.js index 192aa3ce40..66421ed455 100644 --- a/app/javascript/mastodon/actions/blocks.js +++ b/app/javascript/mastodon/actions/blocks.js @@ -1,4 +1,5 @@ import api, { getLinks } from '../api'; + import { fetchRelationships } from './accounts'; import { importFetchedAccounts } from './importer'; import { openModal } from './modal'; diff --git a/app/javascript/mastodon/actions/bookmarks.js b/app/javascript/mastodon/actions/bookmarks.js index 3c8eec5468..0b16f61e63 100644 --- a/app/javascript/mastodon/actions/bookmarks.js +++ b/app/javascript/mastodon/actions/bookmarks.js @@ -1,4 +1,5 @@ import api, { getLinks } from '../api'; + import { importFetchedStatuses } from './importer'; export const BOOKMARKED_STATUSES_FETCH_REQUEST = 'BOOKMARKED_STATUSES_FETCH_REQUEST'; diff --git a/app/javascript/mastodon/actions/compose.js b/app/javascript/mastodon/actions/compose.js index bf504b88a8..22454cf3df 100644 --- a/app/javascript/mastodon/actions/compose.js +++ b/app/javascript/mastodon/actions/compose.js @@ -1,9 +1,12 @@ +import { defineMessages } from 'react-intl'; + import axios from 'axios'; import { throttle } from 'lodash'; -import { defineMessages } from 'react-intl'; + import api from 'mastodon/api'; import { search as emojiSearch } from 'mastodon/features/emoji/emoji_mart_search_light'; import { tagHistory } from 'mastodon/settings'; + import { showAlert, showAlertForError } from './alerts'; import { useEmoji } from './emojis'; import { importFetchedAccounts, importFetchedStatus } from './importer'; diff --git a/app/javascript/mastodon/actions/conversations.js b/app/javascript/mastodon/actions/conversations.js index 4ef654b1f9..8c4c4529fb 100644 --- a/app/javascript/mastodon/actions/conversations.js +++ b/app/javascript/mastodon/actions/conversations.js @@ -1,4 +1,5 @@ import api, { getLinks } from '../api'; + import { importFetchedAccounts, importFetchedStatuses, diff --git a/app/javascript/mastodon/actions/directory.js b/app/javascript/mastodon/actions/directory.js index 4b2b6dd56d..cda63f2b5a 100644 --- a/app/javascript/mastodon/actions/directory.js +++ b/app/javascript/mastodon/actions/directory.js @@ -1,6 +1,7 @@ import api from '../api'; -import { importFetchedAccounts } from './importer'; + import { fetchRelationships } from './accounts'; +import { importFetchedAccounts } from './importer'; export const DIRECTORY_FETCH_REQUEST = 'DIRECTORY_FETCH_REQUEST'; export const DIRECTORY_FETCH_SUCCESS = 'DIRECTORY_FETCH_SUCCESS'; diff --git a/app/javascript/mastodon/actions/favourites.js b/app/javascript/mastodon/actions/favourites.js index 7388e0c580..2d4d4e6206 100644 --- a/app/javascript/mastodon/actions/favourites.js +++ b/app/javascript/mastodon/actions/favourites.js @@ -1,4 +1,5 @@ import api, { getLinks } from '../api'; + import { importFetchedStatuses } from './importer'; export const FAVOURITED_STATUSES_FETCH_REQUEST = 'FAVOURITED_STATUSES_FETCH_REQUEST'; diff --git a/app/javascript/mastodon/actions/filters.js b/app/javascript/mastodon/actions/filters.js index e9c609fc87..3774ee042a 100644 --- a/app/javascript/mastodon/actions/filters.js +++ b/app/javascript/mastodon/actions/filters.js @@ -1,4 +1,5 @@ import api from '../api'; + import { openModal } from './modal'; export const FILTERS_FETCH_REQUEST = 'FILTERS_FETCH_REQUEST'; diff --git a/app/javascript/mastodon/actions/history.js b/app/javascript/mastodon/actions/history.js index c142aaf617..52401b7dce 100644 --- a/app/javascript/mastodon/actions/history.js +++ b/app/javascript/mastodon/actions/history.js @@ -1,4 +1,5 @@ import api from '../api'; + import { importFetchedAccounts } from './importer'; export const HISTORY_FETCH_REQUEST = 'HISTORY_FETCH_REQUEST'; diff --git a/app/javascript/mastodon/actions/importer/normalizer.js b/app/javascript/mastodon/actions/importer/normalizer.js index 8a22f83fa4..61062fd2c8 100644 --- a/app/javascript/mastodon/actions/importer/normalizer.js +++ b/app/javascript/mastodon/actions/importer/normalizer.js @@ -1,7 +1,8 @@ import escapeTextContentForBrowser from 'escape-html'; + import emojify from '../../features/emoji/emoji'; -import { unescapeHTML } from '../../utils/html'; import { expandSpoilers } from '../../initial_state'; +import { unescapeHTML } from '../../utils/html'; const domParser = new DOMParser(); diff --git a/app/javascript/mastodon/actions/interactions.js b/app/javascript/mastodon/actions/interactions.js index bc35736ffa..092a67ea75 100644 --- a/app/javascript/mastodon/actions/interactions.js +++ b/app/javascript/mastodon/actions/interactions.js @@ -1,4 +1,5 @@ import api from '../api'; + import { importFetchedAccounts, importFetchedStatus } from './importer'; export const REBLOG_REQUEST = 'REBLOG_REQUEST'; diff --git a/app/javascript/mastodon/actions/lists.js b/app/javascript/mastodon/actions/lists.js index 5ab9224363..2faa54b955 100644 --- a/app/javascript/mastodon/actions/lists.js +++ b/app/javascript/mastodon/actions/lists.js @@ -1,6 +1,7 @@ import api from '../api'; -import { importFetchedAccounts } from './importer'; + import { showAlertForError } from './alerts'; +import { importFetchedAccounts } from './importer'; export const LIST_FETCH_REQUEST = 'LIST_FETCH_REQUEST'; export const LIST_FETCH_SUCCESS = 'LIST_FETCH_SUCCESS'; diff --git a/app/javascript/mastodon/actions/markers.js b/app/javascript/mastodon/actions/markers.js index b23ecccc39..cfc329a8b7 100644 --- a/app/javascript/mastodon/actions/markers.js +++ b/app/javascript/mastodon/actions/markers.js @@ -1,8 +1,10 @@ -import api from '../api'; -import { debounce } from 'lodash'; -import { compareId } from '../compare_id'; import { List as ImmutableList } from 'immutable'; +import { debounce } from 'lodash'; + +import api from '../api'; +import { compareId } from '../compare_id'; + export const MARKERS_FETCH_REQUEST = 'MARKERS_FETCH_REQUEST'; export const MARKERS_FETCH_SUCCESS = 'MARKERS_FETCH_SUCCESS'; export const MARKERS_FETCH_FAIL = 'MARKERS_FETCH_FAIL'; diff --git a/app/javascript/mastodon/actions/mutes.js b/app/javascript/mastodon/actions/mutes.js index cbc42a67eb..e61a14af24 100644 --- a/app/javascript/mastodon/actions/mutes.js +++ b/app/javascript/mastodon/actions/mutes.js @@ -1,4 +1,5 @@ import api, { getLinks } from '../api'; + import { fetchRelationships } from './accounts'; import { importFetchedAccounts } from './importer'; import { openModal } from './modal'; diff --git a/app/javascript/mastodon/actions/notifications.js b/app/javascript/mastodon/actions/notifications.js index 0c58f8d159..c040edb58b 100644 --- a/app/javascript/mastodon/actions/notifications.js +++ b/app/javascript/mastodon/actions/notifications.js @@ -1,5 +1,15 @@ -import api, { getLinks } from '../api'; import IntlMessageFormat from 'intl-messageformat'; +import { defineMessages } from 'react-intl'; + +import { List as ImmutableList } from 'immutable'; + +import { compareId } from 'mastodon/compare_id'; +import { usePendingItems as preferPendingItems } from 'mastodon/initial_state'; + +import api, { getLinks } from '../api'; +import { unescapeHTML } from '../utils/html'; +import { requestNotificationPermission } from '../utils/notifications'; + import { fetchFollowRequests, fetchRelationships } from './accounts'; import { importFetchedAccount, @@ -9,12 +19,6 @@ import { } from './importer'; import { submitMarkers } from './markers'; import { saveSettings } from './settings'; -import { defineMessages } from 'react-intl'; -import { List as ImmutableList } from 'immutable'; -import { unescapeHTML } from '../utils/html'; -import { usePendingItems as preferPendingItems } from 'mastodon/initial_state'; -import { compareId } from 'mastodon/compare_id'; -import { requestNotificationPermission } from '../utils/notifications'; export const NOTIFICATIONS_UPDATE = 'NOTIFICATIONS_UPDATE'; export const NOTIFICATIONS_UPDATE_NOOP = 'NOTIFICATIONS_UPDATE_NOOP'; diff --git a/app/javascript/mastodon/actions/pin_statuses.js b/app/javascript/mastodon/actions/pin_statuses.js index 1e4bd37bf0..baa10d1562 100644 --- a/app/javascript/mastodon/actions/pin_statuses.js +++ b/app/javascript/mastodon/actions/pin_statuses.js @@ -1,8 +1,8 @@ import api from '../api'; -import { importFetchedStatuses } from './importer'; - import { me } from '../initial_state'; +import { importFetchedStatuses } from './importer'; + export const PINNED_STATUSES_FETCH_REQUEST = 'PINNED_STATUSES_FETCH_REQUEST'; export const PINNED_STATUSES_FETCH_SUCCESS = 'PINNED_STATUSES_FETCH_SUCCESS'; export const PINNED_STATUSES_FETCH_FAIL = 'PINNED_STATUSES_FETCH_FAIL'; diff --git a/app/javascript/mastodon/actions/polls.js b/app/javascript/mastodon/actions/polls.js index 8e8b82df5d..a37410dc90 100644 --- a/app/javascript/mastodon/actions/polls.js +++ b/app/javascript/mastodon/actions/polls.js @@ -1,4 +1,5 @@ import api from '../api'; + import { importFetchedPoll } from './importer'; export const POLL_VOTE_REQUEST = 'POLL_VOTE_REQUEST'; diff --git a/app/javascript/mastodon/actions/push_notifications/index.js b/app/javascript/mastodon/actions/push_notifications/index.js index 9dcc4bd4bb..46b63867f1 100644 --- a/app/javascript/mastodon/actions/push_notifications/index.js +++ b/app/javascript/mastodon/actions/push_notifications/index.js @@ -1,5 +1,5 @@ -import { setAlerts } from './setter'; import { saveSettings } from './registerer'; +import { setAlerts } from './setter'; export function changeAlerts(path, value) { return dispatch => { diff --git a/app/javascript/mastodon/actions/push_notifications/registerer.js b/app/javascript/mastodon/actions/push_notifications/registerer.js index b491f85c24..b3d3850e31 100644 --- a/app/javascript/mastodon/actions/push_notifications/registerer.js +++ b/app/javascript/mastodon/actions/push_notifications/registerer.js @@ -1,8 +1,9 @@ import api from '../../api'; -import { decode as decodeBase64 } from '../../utils/base64'; -import { pushNotificationsSetting } from '../../settings'; -import { setBrowserSupport, setSubscription, clearSubscription } from './setter'; import { me } from '../../initial_state'; +import { pushNotificationsSetting } from '../../settings'; +import { decode as decodeBase64 } from '../../utils/base64'; + +import { setBrowserSupport, setSubscription, clearSubscription } from './setter'; // Taken from https://www.npmjs.com/package/web-push const urlBase64ToUint8Array = (base64String) => { diff --git a/app/javascript/mastodon/actions/reports.js b/app/javascript/mastodon/actions/reports.js index fbe5b3791b..b3f9bf1ac3 100644 --- a/app/javascript/mastodon/actions/reports.js +++ b/app/javascript/mastodon/actions/reports.js @@ -1,4 +1,5 @@ import api from '../api'; + import { openModal } from './modal'; export const REPORT_SUBMIT_REQUEST = 'REPORT_SUBMIT_REQUEST'; diff --git a/app/javascript/mastodon/actions/search.js b/app/javascript/mastodon/actions/search.js index 605a457a2e..94e7f2ed75 100644 --- a/app/javascript/mastodon/actions/search.js +++ b/app/javascript/mastodon/actions/search.js @@ -1,4 +1,5 @@ import api from '../api'; + import { fetchRelationships } from './accounts'; import { importFetchedAccounts, importFetchedStatuses } from './importer'; diff --git a/app/javascript/mastodon/actions/server.js b/app/javascript/mastodon/actions/server.js index 091af0f0fe..bd784906d4 100644 --- a/app/javascript/mastodon/actions/server.js +++ b/app/javascript/mastodon/actions/server.js @@ -1,4 +1,5 @@ import api from '../api'; + import { importFetchedAccount } from './importer'; export const SERVER_FETCH_REQUEST = 'Server_FETCH_REQUEST'; diff --git a/app/javascript/mastodon/actions/settings.js b/app/javascript/mastodon/actions/settings.js index 6ae001b6ff..3685b0684e 100644 --- a/app/javascript/mastodon/actions/settings.js +++ b/app/javascript/mastodon/actions/settings.js @@ -1,5 +1,7 @@ -import api from '../api'; import { debounce } from 'lodash'; + +import api from '../api'; + import { showAlertForError } from './alerts'; export const SETTING_CHANGE = 'SETTING_CHANGE'; diff --git a/app/javascript/mastodon/actions/statuses.js b/app/javascript/mastodon/actions/statuses.js index 275280a537..84a1271b8b 100644 --- a/app/javascript/mastodon/actions/statuses.js +++ b/app/javascript/mastodon/actions/statuses.js @@ -1,8 +1,8 @@ import api from '../api'; -import { deleteFromTimelines } from './timelines'; -import { importFetchedStatus, importFetchedStatuses, importFetchedAccount } from './importer'; import { ensureComposeIsVisible, setComposeToStatus } from './compose'; +import { importFetchedStatus, importFetchedStatuses, importFetchedAccount } from './importer'; +import { deleteFromTimelines } from './timelines'; export const STATUS_FETCH_REQUEST = 'STATUS_FETCH_REQUEST'; export const STATUS_FETCH_SUCCESS = 'STATUS_FETCH_SUCCESS'; diff --git a/app/javascript/mastodon/actions/store.js b/app/javascript/mastodon/actions/store.js index b3030467b3..6b0743439b 100644 --- a/app/javascript/mastodon/actions/store.js +++ b/app/javascript/mastodon/actions/store.js @@ -1,4 +1,5 @@ import { Iterable, fromJS } from 'immutable'; + import { hydrateCompose } from './compose'; import { importFetchedAccounts } from './importer'; diff --git a/app/javascript/mastodon/actions/streaming.js b/app/javascript/mastodon/actions/streaming.js index 7831f261e6..562e72655c 100644 --- a/app/javascript/mastodon/actions/streaming.js +++ b/app/javascript/mastodon/actions/streaming.js @@ -1,6 +1,17 @@ // @ts-check +import { getLocale } from '../locales'; import { connectStream } from '../stream'; + +import { + fetchAnnouncements, + updateAnnouncements, + updateReaction as updateAnnouncementsReaction, + deleteAnnouncement, +} from './announcements'; +import { updateConversations } from './conversations'; +import { updateNotifications, expandNotifications } from './notifications'; +import { updateStatus } from './statuses'; import { updateTimeline, deleteFromTimelines, @@ -12,16 +23,6 @@ import { fillCommunityTimelineGaps, fillListTimelineGaps, } from './timelines'; -import { updateNotifications, expandNotifications } from './notifications'; -import { updateConversations } from './conversations'; -import { updateStatus } from './statuses'; -import { - fetchAnnouncements, - updateAnnouncements, - updateReaction as updateAnnouncementsReaction, - deleteAnnouncement, -} from './announcements'; -import { getLocale } from '../locales'; const { messages } = getLocale(); diff --git a/app/javascript/mastodon/actions/suggestions.js b/app/javascript/mastodon/actions/suggestions.js index 9e8cd1ea40..870a311024 100644 --- a/app/javascript/mastodon/actions/suggestions.js +++ b/app/javascript/mastodon/actions/suggestions.js @@ -1,6 +1,7 @@ import api from '../api'; -import { importFetchedAccounts } from './importer'; + import { fetchRelationships } from './accounts'; +import { importFetchedAccounts } from './importer'; export const SUGGESTIONS_FETCH_REQUEST = 'SUGGESTIONS_FETCH_REQUEST'; export const SUGGESTIONS_FETCH_SUCCESS = 'SUGGESTIONS_FETCH_SUCCESS'; diff --git a/app/javascript/mastodon/actions/timelines.js b/app/javascript/mastodon/actions/timelines.js index e9e3a8e240..96dc4a2a1e 100644 --- a/app/javascript/mastodon/actions/timelines.js +++ b/app/javascript/mastodon/actions/timelines.js @@ -1,10 +1,12 @@ -import { importFetchedStatus, importFetchedStatuses } from './importer'; -import { submitMarkers } from './markers'; -import api, { getLinks } from 'mastodon/api'; import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; + +import api, { getLinks } from 'mastodon/api'; import { compareId } from 'mastodon/compare_id'; import { usePendingItems as preferPendingItems } from 'mastodon/initial_state'; +import { importFetchedStatus, importFetchedStatuses } from './importer'; +import { submitMarkers } from './markers'; + export const TIMELINE_UPDATE = 'TIMELINE_UPDATE'; export const TIMELINE_DELETE = 'TIMELINE_DELETE'; export const TIMELINE_CLEAR = 'TIMELINE_CLEAR'; diff --git a/app/javascript/mastodon/actions/trends.js b/app/javascript/mastodon/actions/trends.js index edda0b5b5d..d314423884 100644 --- a/app/javascript/mastodon/actions/trends.js +++ b/app/javascript/mastodon/actions/trends.js @@ -1,4 +1,5 @@ import api, { getLinks } from '../api'; + import { importFetchedStatuses } from './importer'; export const TRENDS_TAGS_FETCH_REQUEST = 'TRENDS_TAGS_FETCH_REQUEST'; diff --git a/app/javascript/mastodon/api.js b/app/javascript/mastodon/api.js index 42b64d6cc5..1c171a1c4a 100644 --- a/app/javascript/mastodon/api.js +++ b/app/javascript/mastodon/api.js @@ -2,6 +2,7 @@ import axios from 'axios'; import LinkHeader from 'http-link-header'; + import ready from './ready'; /** diff --git a/app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.jsx b/app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.jsx index 80aa33a187..2603420aec 100644 --- a/app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.jsx +++ b/app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.jsx @@ -1,4 +1,5 @@ import renderer from 'react-test-renderer'; + import AutosuggestEmoji from '../autosuggest_emoji'; describe('', () => { diff --git a/app/javascript/mastodon/components/__tests__/avatar-test.jsx b/app/javascript/mastodon/components/__tests__/avatar-test.jsx index b20c6f4e39..21c3ae5800 100644 --- a/app/javascript/mastodon/components/__tests__/avatar-test.jsx +++ b/app/javascript/mastodon/components/__tests__/avatar-test.jsx @@ -1,5 +1,7 @@ -import renderer from 'react-test-renderer'; import { fromJS } from 'immutable'; + +import renderer from 'react-test-renderer'; + import { Avatar } from '../avatar'; describe('', () => { diff --git a/app/javascript/mastodon/components/__tests__/avatar_overlay-test.jsx b/app/javascript/mastodon/components/__tests__/avatar_overlay-test.jsx index c03a9aa9d0..99a440af7c 100644 --- a/app/javascript/mastodon/components/__tests__/avatar_overlay-test.jsx +++ b/app/javascript/mastodon/components/__tests__/avatar_overlay-test.jsx @@ -1,5 +1,7 @@ -import renderer from 'react-test-renderer'; import { fromJS } from 'immutable'; + +import renderer from 'react-test-renderer'; + import { AvatarOverlay } from '../avatar_overlay'; describe(' { diff --git a/app/javascript/mastodon/components/__tests__/button-test.jsx b/app/javascript/mastodon/components/__tests__/button-test.jsx index 82d307e843..6de961f784 100644 --- a/app/javascript/mastodon/components/__tests__/button-test.jsx +++ b/app/javascript/mastodon/components/__tests__/button-test.jsx @@ -1,5 +1,6 @@ import { render, fireEvent, screen } from '@testing-library/react'; import renderer from 'react-test-renderer'; + import Button from '../button'; describe(' - ); - } - -} - -export default injectIntl(LoadGap); diff --git a/app/javascript/mastodon/components/load_gap.tsx b/app/javascript/mastodon/components/load_gap.tsx new file mode 100644 index 0000000000..f741f68341 --- /dev/null +++ b/app/javascript/mastodon/components/load_gap.tsx @@ -0,0 +1,36 @@ +import { useCallback } from 'react'; + +import type { InjectedIntl } from 'react-intl'; +import { injectIntl, defineMessages } from 'react-intl'; + +import { Icon } from 'mastodon/components/icon'; + +const messages = defineMessages({ + load_more: { id: 'status.load_more', defaultMessage: 'Load more' }, +}); + +interface Props { + disabled: boolean; + maxId: string; + onClick: (maxId: string) => void; + intl: InjectedIntl; +} + +export const LoadGap = injectIntl( + ({ disabled, maxId, onClick, intl }) => { + const handleClick = useCallback(() => { + onClick(maxId); + }, [maxId, onClick]); + + return ( + + ); + } +); diff --git a/app/javascript/mastodon/components/status_list.jsx b/app/javascript/mastodon/components/status_list.jsx index ff9c98b4ea..e92dd233e1 100644 --- a/app/javascript/mastodon/components/status_list.jsx +++ b/app/javascript/mastodon/components/status_list.jsx @@ -9,7 +9,7 @@ import RegenerationIndicator from 'mastodon/components/regeneration_indicator'; import StatusContainer from '../containers/status_container'; -import LoadGap from './load_gap'; +import { LoadGap } from './load_gap'; import ScrollableList from './scrollable_list'; export default class StatusList extends ImmutablePureComponent { diff --git a/app/javascript/mastodon/features/notifications/index.jsx b/app/javascript/mastodon/features/notifications/index.jsx index ef889acbc0..9fd2cf4b18 100644 --- a/app/javascript/mastodon/features/notifications/index.jsx +++ b/app/javascript/mastodon/features/notifications/index.jsx @@ -28,7 +28,7 @@ import { } from '../../actions/notifications'; import Column from '../../components/column'; import ColumnHeader from '../../components/column_header'; -import LoadGap from '../../components/load_gap'; +import { LoadGap } from '../../components/load_gap'; import ScrollableList from '../../components/scrollable_list'; import NotificationsPermissionBanner from './components/notifications_permission_banner'; From 40b948a1fba629c00f37cb5b0065843fd91f4e98 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Wed, 24 May 2023 09:49:26 +0200 Subject: [PATCH 08/17] Fix `null` signUp URL handling from #25014 (#25108) --- app/javascript/mastodon/features/ui/components/header.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/mastodon/features/ui/components/header.jsx b/app/javascript/mastodon/features/ui/components/header.jsx index f13ceb4a82..04651bab18 100644 --- a/app/javascript/mastodon/features/ui/components/header.jsx +++ b/app/javascript/mastodon/features/ui/components/header.jsx @@ -21,7 +21,7 @@ const Account = connect(state => ({ )); const mapStateToProps = (state) => ({ - signupUrl: state.getIn(['server', 'server', 'registrations', 'url'], '/auth/sign_up'), + signupUrl: state.getIn(['server', 'server', 'registrations', 'url'], null) || '/auth/sign_up', }); const mapDispatchToProps = (dispatch) => ({ From 342daeb389ec5988465fe978c1cc46d0fc9d19a1 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Wed, 24 May 2023 10:23:17 +0200 Subject: [PATCH 09/17] Update `react-redux` (#25110) --- .github/dependabot.yml | 4 ---- package.json | 3 +-- yarn.lock | 54 +++++++++++++++++------------------------- 3 files changed, 23 insertions(+), 38 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index af7efbe6cf..39ae6bc080 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -41,10 +41,6 @@ updates: - dependency-name: 'webpack-dev-server' versions: - '>= 4' - # TODO: This version requires code changes https://github.com/reduxjs/react-redux/releases/tag/v8.0.0 - - dependency-name: 'react-redux' - versions: - - '>= 4' # TODO: This version was ignored in https://github.com/mastodon/mastodon/pull/15238 - dependency-name: 'webpack-cli' versions: diff --git a/package.json b/package.json index 38eaa7bf87..630ecc4659 100644 --- a/package.json +++ b/package.json @@ -97,7 +97,7 @@ "react-motion": "^0.5.2", "react-notification": "^6.8.5", "react-overlays": "^5.2.1", - "react-redux": "^7.2.9", + "react-redux": "^8.0.4", "react-redux-loading-bar": "^5.0.4", "react-router-dom": "^4.1.1", "react-router-scroll-4": "^1.0.0-beta.1", @@ -162,7 +162,6 @@ "@types/react-intl": "2.3.18", "@types/react-motion": "^0.0.33", "@types/react-overlays": "^3.1.0", - "@types/react-redux": "^7.1.25", "@types/react-router-dom": "^5.3.3", "@types/react-select": "^5.0.1", "@types/react-sparklines": "^1.7.2", diff --git a/yarn.lock b/yarn.lock index 88603113bd..a61aa54253 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1062,7 +1062,7 @@ dependencies: regenerator-runtime "^0.12.0" -"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.0", "@babel/runtime@^7.12.5", "@babel/runtime@^7.13.10", "@babel/runtime@^7.13.8", "@babel/runtime@^7.15.4", "@babel/runtime@^7.2.0", "@babel/runtime@^7.20.13", "@babel/runtime@^7.20.7", "@babel/runtime@^7.21.5", "@babel/runtime@^7.3.1", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.3", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2": +"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.0", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.5", "@babel/runtime@^7.13.10", "@babel/runtime@^7.13.8", "@babel/runtime@^7.2.0", "@babel/runtime@^7.20.13", "@babel/runtime@^7.20.7", "@babel/runtime@^7.21.5", "@babel/runtime@^7.3.1", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.3", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2": version "7.21.5" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.21.5.tgz#8492dddda9644ae3bda3b45eabe87382caee7200" integrity sha512-8jI69toZqqcsnqGGqwGS4Qb1VwLOEp4hz+CXPywcvjs60u3B4Pom/U/7rm4W8tMOYEB+E9wgD0mW1l3r8qlI9Q== @@ -2006,7 +2006,7 @@ resolved "https://registry.yarnpkg.com/@types/history/-/history-4.7.11.tgz#56588b17ae8f50c53983a524fc3cc47437969d64" integrity sha512-qjDJRrmvBMiTx+jyLxvLfJU7UznFuokDv4f3WRuriHKERccVpFU+8XMQUAbDzoiJCsmexxRExQeMwwCdamSKDA== -"@types/hoist-non-react-statics@^3.3.0": +"@types/hoist-non-react-statics@^3.3.1": version "3.3.1" resolved "https://registry.yarnpkg.com/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz#1124aafe5118cb591977aeb1ceaaed1070eb039f" integrity sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA== @@ -2222,26 +2222,6 @@ dependencies: react-overlays "*" -"@types/react-redux@^7.1.20": - version "7.1.20" - resolved "https://registry.yarnpkg.com/@types/react-redux/-/react-redux-7.1.20.tgz#42f0e61ababb621e12c66c96dda94c58423bd7df" - integrity sha512-q42es4c8iIeTgcnB+yJgRTTzftv3eYYvCZOh1Ckn2eX/3o5TdsQYKUWpLoLuGlcY/p+VAhV9IOEZJcWk/vfkXw== - dependencies: - "@types/hoist-non-react-statics" "^3.3.0" - "@types/react" "*" - hoist-non-react-statics "^3.3.0" - redux "^4.0.0" - -"@types/react-redux@^7.1.25": - version "7.1.25" - resolved "https://registry.yarnpkg.com/@types/react-redux/-/react-redux-7.1.25.tgz#de841631205b24f9dfb4967dd4a7901e048f9a88" - integrity sha512-bAGh4e+w5D8dajd6InASVIyCo4pZLJ66oLb80F9OBLO1gKESbZcRCJpTT6uLXX+HAB57zw1WTdwJdAsewuTweg== - dependencies: - "@types/hoist-non-react-statics" "^3.3.0" - "@types/react" "*" - hoist-non-react-statics "^3.3.0" - redux "^4.0.0" - "@types/react-router-dom@^5.3.3": version "5.3.3" resolved "https://registry.yarnpkg.com/@types/react-router-dom/-/react-router-dom-5.3.3.tgz#e9d6b4a66fcdbd651a5f106c2656a30088cc1e83" @@ -2399,6 +2379,11 @@ dependencies: source-map "^0.6.1" +"@types/use-sync-external-store@^0.0.3": + version "0.0.3" + resolved "https://registry.yarnpkg.com/@types/use-sync-external-store/-/use-sync-external-store-0.0.3.tgz#b6725d5f4af24ace33b36fafd295136e75509f43" + integrity sha512-EwmlvuaxPNej9+T4v5AuBPJa2x2UOJVdjCtDHgcDqitUeOtjnJKJ+apYjVcAoBEMjKW1VVFGZLUb5+qqa09XFA== + "@types/uuid@^9.0.0": version "9.0.1" resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.1.tgz#98586dc36aee8dacc98cc396dbca8d0429647aa6" @@ -9584,7 +9569,7 @@ react-is@^16.13.1, react-is@^16.7.0: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== -react-is@^17.0.1, react-is@^17.0.2: +react-is@^17.0.1: version "17.0.2" resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== @@ -9637,17 +9622,17 @@ react-redux-loading-bar@^5.0.4: prop-types "^15.7.2" react-lifecycles-compat "^3.0.4" -react-redux@^7.2.9: - version "7.2.9" - resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-7.2.9.tgz#09488fbb9416a4efe3735b7235055442b042481d" - integrity sha512-Gx4L3uM182jEEayZfRbI/G11ZpYdNAnBs70lFVMNdHJI76XYtR+7m0MN+eAs7UHBPhWXcnFPaS+9owSCJQHNpQ== +react-redux@^8.0.4: + version "8.0.5" + resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-8.0.5.tgz#e5fb8331993a019b8aaf2e167a93d10af469c7bd" + integrity sha512-Q2f6fCKxPFpkXt1qNRZdEDLlScsDWyrgSj0mliK59qU6W5gvBiKkdMEG2lJzhd1rCctf0hb6EtePPLZ2e0m1uw== dependencies: - "@babel/runtime" "^7.15.4" - "@types/react-redux" "^7.1.20" + "@babel/runtime" "^7.12.1" + "@types/hoist-non-react-statics" "^3.3.1" + "@types/use-sync-external-store" "^0.0.3" hoist-non-react-statics "^3.3.2" - loose-envify "^1.4.0" - prop-types "^15.7.2" - react-is "^17.0.2" + react-is "^18.0.0" + use-sync-external-store "^1.0.0" react-router-dom@^4.1.1: version "4.3.1" @@ -11701,6 +11686,11 @@ use-latest@^1.2.1: dependencies: use-isomorphic-layout-effect "^1.1.1" +use-sync-external-store@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a" + integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA== + use@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" From ac98e9fdbc9158574fdcc191a329ca86fb819d98 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 May 2023 10:46:10 +0200 Subject: [PATCH 10/17] Bump fastimage from 2.2.6 to 2.2.7 (#25111) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 21647e1b69..9d3581530d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -269,7 +269,7 @@ GEM faraday-rack (1.0.0) faraday-retry (1.0.3) fast_blank (1.0.1) - fastimage (2.2.6) + fastimage (2.2.7) ffi (1.15.5) ffi-compiler (1.0.1) ffi (>= 1.0.0) From 2e3b1ef13ea5093b1bd0f985f00612dde21b0ffd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 May 2023 10:47:50 +0200 Subject: [PATCH 11/17] Bump eslint-plugin-jsdoc from 44.2.4 to 44.2.5 (#25112) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 630ecc4659..f28acea2c4 100644 --- a/package.json +++ b/package.json @@ -182,7 +182,7 @@ "eslint-import-resolver-typescript": "^3.5.5", "eslint-plugin-formatjs": "^4.10.1", "eslint-plugin-import": "~2.27.5", - "eslint-plugin-jsdoc": "^44.2.4", + "eslint-plugin-jsdoc": "^44.2.5", "eslint-plugin-jsx-a11y": "~6.7.1", "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-promise": "~6.1.1", diff --git a/yarn.lock b/yarn.lock index a61aa54253..ca7a998abb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1216,10 +1216,10 @@ resolved "https://registry.yarnpkg.com/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz#8eed982e2ee6f7f4e44c253e12962980791efd46" integrity sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA== -"@es-joy/jsdoccomment@~0.39.3": - version "0.39.3" - resolved "https://registry.yarnpkg.com/@es-joy/jsdoccomment/-/jsdoccomment-0.39.3.tgz#76b55203bf447d608e4e299ecb62d7ef14db72bb" - integrity sha512-q6pObzaS+aTA96kl4DF91QILNpSiDE8S89cQdJnhIc7hWzwIHPnfBnsiBVa0Z/R9pLHdZTnXEMnggGMmCq7HmA== +"@es-joy/jsdoccomment@~0.39.4": + version "0.39.4" + resolved "https://registry.yarnpkg.com/@es-joy/jsdoccomment/-/jsdoccomment-0.39.4.tgz#6b8a62e9b3077027837728818d3c4389a898b392" + integrity sha512-Jvw915fjqQct445+yron7Dufix9A+m9j1fCJYlCo1FWlRvTxa3pjJelxdSTdaLWcTwRU6vbL+NYjO4YuNIS5Qg== dependencies: comment-parser "1.3.1" esquery "^1.5.0" @@ -5075,12 +5075,12 @@ eslint-plugin-import@~2.27.5: semver "^6.3.0" tsconfig-paths "^3.14.1" -eslint-plugin-jsdoc@^44.2.4: - version "44.2.4" - resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-44.2.4.tgz#0bdc163771504ec7330414eda6a7dbae67156ddb" - integrity sha512-/EMMxCyRh1SywhCb66gAqoGX4Yv6Xzc4bsSkF1AiY2o2+bQmGMQ05QZ5+JjHbdFTPDZY9pfn+DsSNP0a5yQpIg== +eslint-plugin-jsdoc@^44.2.5: + version "44.2.5" + resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-44.2.5.tgz#f3186f57f112a230b3b7af34bf236d207bc8d5d7" + integrity sha512-KtuhaYy2GmdY2IQE5t+1lup8O4P05c+V4gKcj45PCxFM0OxmRq2uQlfOS1AgYVgPYIBKGE86DxrbKP24HKpORA== dependencies: - "@es-joy/jsdoccomment" "~0.39.3" + "@es-joy/jsdoccomment" "~0.39.4" are-docs-informative "^0.0.2" comment-parser "1.3.1" debug "^4.3.4" From f7d93f95e12271b1d209cee276b454c265c93b3f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 May 2023 10:52:10 +0200 Subject: [PATCH 12/17] Bump capistrano from 3.17.2 to 3.17.3 (#25113) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9d3581530d..85cc20e633 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -151,7 +151,7 @@ GEM bundler-audit (0.9.1) bundler (>= 1.2.0, < 3) thor (~> 1.0) - capistrano (3.17.2) + capistrano (3.17.3) airbrussh (>= 1.0.0) i18n rake (>= 10.0.0) From 1caa5ff39e95f01eb74ee71b76eaa6c0fd7309fd Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 24 May 2023 11:04:43 +0200 Subject: [PATCH 13/17] Change share action from being in action bar to being in dropdown in web UI (#25105) Co-authored-by: Claire --- .../mastodon/components/status_action_bar.jsx | 11 ++++------- .../features/account/components/header.jsx | 1 - .../features/status/components/action_bar.jsx | 14 ++++++-------- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/app/javascript/mastodon/components/status_action_bar.jsx b/app/javascript/mastodon/components/status_action_bar.jsx index 83c5ef0e4a..936a66080e 100644 --- a/app/javascript/mastodon/components/status_action_bar.jsx +++ b/app/javascript/mastodon/components/status_action_bar.jsx @@ -114,7 +114,6 @@ class StatusActionBar extends ImmutablePureComponent { handleShareClick = () => { navigator.share({ - text: this.props.status.get('search_index'), url: this.props.status.get('url'), }).catch((e) => { if (e.name !== 'AbortError') console.error(e); @@ -256,6 +255,10 @@ class StatusActionBar extends ImmutablePureComponent { menu.push({ text: intl.formatMessage(messages.copy), action: this.handleCopy }); + if (publicStatus && 'share' in navigator) { + menu.push({ text: intl.formatMessage(messages.share), action: this.handleShareClick }); + } + if (publicStatus) { menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed }); } @@ -352,10 +355,6 @@ class StatusActionBar extends ImmutablePureComponent { reblogTitle = intl.formatMessage(messages.cannot_reblog); } - const shareButton = ('share' in navigator) && publicStatus && ( - - ); - const filterButton = this.props.onFilter && ( ); @@ -367,8 +366,6 @@ class StatusActionBar extends ImmutablePureComponent { - {shareButton} - {filterButton}
diff --git a/app/javascript/mastodon/features/account/components/header.jsx b/app/javascript/mastodon/features/account/components/header.jsx index 6ebb29ab20..e9e5934f46 100644 --- a/app/javascript/mastodon/features/account/components/header.jsx +++ b/app/javascript/mastodon/features/account/components/header.jsx @@ -165,7 +165,6 @@ class Header extends ImmutablePureComponent { const { account } = this.props; navigator.share({ - text: `${titleFromAccount(account)}\n${account.get('note_plain')}`, url: account.get('url'), }).catch((e) => { if (e.name !== 'AbortError') console.error(e); diff --git a/app/javascript/mastodon/features/status/components/action_bar.jsx b/app/javascript/mastodon/features/status/components/action_bar.jsx index bc5aed4429..bd565c72c6 100644 --- a/app/javascript/mastodon/features/status/components/action_bar.jsx +++ b/app/javascript/mastodon/features/status/components/action_bar.jsx @@ -169,7 +169,6 @@ class ActionBar extends PureComponent { handleShare = () => { navigator.share({ - text: this.props.status.get('search_index'), url: this.props.status.get('url'), }); }; @@ -202,6 +201,11 @@ class ActionBar extends PureComponent { } menu.push({ text: intl.formatMessage(messages.copy), action: this.handleCopy }); + + if ('share' in navigator) { + menu.push({ text: intl.formatMessage(messages.share), action: this.handleShare }); + } + menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed }); menu.push(null); } @@ -260,10 +264,6 @@ class ActionBar extends PureComponent { } } - const shareButton = ('share' in navigator) && publicStatus && ( -
- ); - let replyIcon; if (status.get('in_reply_to_id', null) === null) { replyIcon = 'reply'; @@ -287,12 +287,10 @@ class ActionBar extends PureComponent { return (
-
+
- {shareButton} -
From d2e5430d4a4f3828f5adbd7429752f9f11cfc07f Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Wed, 24 May 2023 05:23:40 -0400 Subject: [PATCH 14/17] Fix RSpec/ExpectChange cop (#25101) --- .rubocop_todo.yml | 17 ----------------- .../account_moderation_notes_controller_spec.rb | 6 +++--- .../admin/custom_emojis_controller_spec.rb | 2 +- .../admin/invites_controller_spec.rb | 2 +- .../admin/report_notes_controller_spec.rb | 10 +++++----- .../concerns/accountable_concern_spec.rb | 2 +- spec/controllers/invites_controller_spec.rb | 2 +- .../webauthn_credentials_controller_spec.rb | 4 ++-- spec/models/admin/account_action_spec.rb | 2 +- spec/services/suspend_account_service_spec.rb | 2 +- spec/services/unsuspend_account_service_spec.rb | 6 +++--- .../accounts_statuses_cleanup_scheduler_spec.rb | 10 +++++----- 12 files changed, 24 insertions(+), 41 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 2e9f6c429f..5711b3d4f2 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -376,23 +376,6 @@ RSpec/EmptyExampleGroup: RSpec/ExampleLength: Max: 22 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: method_call, block -RSpec/ExpectChange: - Exclude: - - 'spec/controllers/admin/account_moderation_notes_controller_spec.rb' - - 'spec/controllers/admin/custom_emojis_controller_spec.rb' - - 'spec/controllers/admin/invites_controller_spec.rb' - - 'spec/controllers/admin/report_notes_controller_spec.rb' - - 'spec/controllers/concerns/accountable_concern_spec.rb' - - 'spec/controllers/invites_controller_spec.rb' - - 'spec/controllers/settings/two_factor_authentication/webauthn_credentials_controller_spec.rb' - - 'spec/models/admin/account_action_spec.rb' - - 'spec/services/suspend_account_service_spec.rb' - - 'spec/services/unsuspend_account_service_spec.rb' - - 'spec/workers/scheduler/accounts_statuses_cleanup_scheduler_spec.rb' - # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: implicit, each, example diff --git a/spec/controllers/admin/account_moderation_notes_controller_spec.rb b/spec/controllers/admin/account_moderation_notes_controller_spec.rb index 848281c290..3e1b4b280f 100644 --- a/spec/controllers/admin/account_moderation_notes_controller_spec.rb +++ b/spec/controllers/admin/account_moderation_notes_controller_spec.rb @@ -19,7 +19,7 @@ RSpec.describe Admin::AccountModerationNotesController do let(:params) { { account_moderation_note: { target_account_id: target_account.id, content: 'test content' } } } it 'successfully creates a note' do - expect { subject }.to change { AccountModerationNote.count }.by(1) + expect { subject }.to change(AccountModerationNote, :count).by(1) expect(subject).to redirect_to admin_account_path(target_account.id) end end @@ -28,7 +28,7 @@ RSpec.describe Admin::AccountModerationNotesController do let(:params) { { account_moderation_note: { target_account_id: target_account.id, content: '' } } } it 'falls to create a note' do - expect { subject }.to_not change { AccountModerationNote.count } + expect { subject }.to_not change(AccountModerationNote, :count) expect(subject).to render_template 'admin/accounts/show' end end @@ -41,7 +41,7 @@ RSpec.describe Admin::AccountModerationNotesController do let(:account) { Fabricate(:account) } it 'destroys note' do - expect { subject }.to change { AccountModerationNote.count }.by(-1) + expect { subject }.to change(AccountModerationNote, :count).by(-1) expect(subject).to redirect_to admin_account_path(target_account.id) end end diff --git a/spec/controllers/admin/custom_emojis_controller_spec.rb b/spec/controllers/admin/custom_emojis_controller_spec.rb index d40691e1bf..6c32a3a579 100644 --- a/spec/controllers/admin/custom_emojis_controller_spec.rb +++ b/spec/controllers/admin/custom_emojis_controller_spec.rb @@ -42,7 +42,7 @@ describe Admin::CustomEmojisController do let(:params) { { shortcode: 'test', image: image } } it 'creates custom emoji' do - expect { subject }.to change { CustomEmoji.count }.by(1) + expect { subject }.to change(CustomEmoji, :count).by(1) end end diff --git a/spec/controllers/admin/invites_controller_spec.rb b/spec/controllers/admin/invites_controller_spec.rb index 92ec4e4491..ca87417305 100644 --- a/spec/controllers/admin/invites_controller_spec.rb +++ b/spec/controllers/admin/invites_controller_spec.rb @@ -26,7 +26,7 @@ describe Admin::InvitesController do subject { post :create, params: { invite: { max_uses: '10', expires_in: 1800 } } } it 'succeeds to create a invite' do - expect { subject }.to change { Invite.count }.by(1) + expect { subject }.to change(Invite, :count).by(1) expect(subject).to redirect_to admin_invites_path expect(Invite.last).to have_attributes(user_id: user.id, max_uses: 10) end diff --git a/spec/controllers/admin/report_notes_controller_spec.rb b/spec/controllers/admin/report_notes_controller_spec.rb index fb2fbd0588..b5ba4a84dc 100644 --- a/spec/controllers/admin/report_notes_controller_spec.rb +++ b/spec/controllers/admin/report_notes_controller_spec.rb @@ -25,7 +25,7 @@ describe Admin::ReportNotesController do let(:params) { { report_note: { content: 'test content', report_id: report.id }, create_and_resolve: nil } } it 'creates a report note and resolves report' do - expect { subject }.to change { ReportNote.count }.by(1) + expect { subject }.to change(ReportNote, :count).by(1) expect(report.reload).to be_action_taken expect(subject).to redirect_to admin_reports_path end @@ -35,7 +35,7 @@ describe Admin::ReportNotesController do let(:params) { { report_note: { content: 'test content', report_id: report.id } } } it 'creates a report note and does not resolve report' do - expect { subject }.to change { ReportNote.count }.by(1) + expect { subject }.to change(ReportNote, :count).by(1) expect(report.reload).to_not be_action_taken expect(subject).to redirect_to admin_report_path(report) end @@ -50,7 +50,7 @@ describe Admin::ReportNotesController do let(:params) { { report_note: { content: 'test content', report_id: report.id }, create_and_unresolve: nil } } it 'creates a report note and unresolves report' do - expect { subject }.to change { ReportNote.count }.by(1) + expect { subject }.to change(ReportNote, :count).by(1) expect(report.reload).to_not be_action_taken expect(subject).to redirect_to admin_report_path(report) end @@ -60,7 +60,7 @@ describe Admin::ReportNotesController do let(:params) { { report_note: { content: 'test content', report_id: report.id } } } it 'creates a report note and does not unresolve report' do - expect { subject }.to change { ReportNote.count }.by(1) + expect { subject }.to change(ReportNote, :count).by(1) expect(report.reload).to be_action_taken expect(subject).to redirect_to admin_report_path(report) end @@ -85,7 +85,7 @@ describe Admin::ReportNotesController do let!(:report_note) { Fabricate(:report_note) } it 'deletes note' do - expect { subject }.to change { ReportNote.count }.by(-1) + expect { subject }.to change(ReportNote, :count).by(-1) expect(subject).to redirect_to admin_report_path(report_note.report) end end diff --git a/spec/controllers/concerns/accountable_concern_spec.rb b/spec/controllers/concerns/accountable_concern_spec.rb index 3c10082c34..cd06d872bb 100644 --- a/spec/controllers/concerns/accountable_concern_spec.rb +++ b/spec/controllers/concerns/accountable_concern_spec.rb @@ -22,7 +22,7 @@ RSpec.describe AccountableConcern do it 'creates Admin::ActionLog' do expect do hoge.log_action(:create, target) - end.to change { Admin::ActionLog.count }.by(1) + end.to change(Admin::ActionLog, :count).by(1) end end end diff --git a/spec/controllers/invites_controller_spec.rb b/spec/controllers/invites_controller_spec.rb index 8718403bf3..3190c82884 100644 --- a/spec/controllers/invites_controller_spec.rb +++ b/spec/controllers/invites_controller_spec.rb @@ -52,7 +52,7 @@ describe InvitesController do end it 'succeeds to create a invite' do - expect { subject }.to change { Invite.count }.by(1) + expect { subject }.to change(Invite, :count).by(1) expect(subject).to redirect_to invites_path expect(Invite.last).to have_attributes(user_id: user.id, max_uses: 10) end diff --git a/spec/controllers/settings/two_factor_authentication/webauthn_credentials_controller_spec.rb b/spec/controllers/settings/two_factor_authentication/webauthn_credentials_controller_spec.rb index 48dea62765..fe4868956c 100644 --- a/spec/controllers/settings/two_factor_authentication/webauthn_credentials_controller_spec.rb +++ b/spec/controllers/settings/two_factor_authentication/webauthn_credentials_controller_spec.rb @@ -134,7 +134,7 @@ describe Settings::TwoFactorAuthentication::WebauthnCredentialsController do end it 'does not change webauthn_id' do - expect { get :options }.to_not change { user.webauthn_id } + expect { get :options }.to_not change(user, :webauthn_id) end it 'includes existing credentials in list of excluded credentials' do @@ -238,7 +238,7 @@ describe Settings::TwoFactorAuthentication::WebauthnCredentialsController do expect do post :create, params: { credential: new_webauthn_credential, nickname: nickname } - end.to_not change { user.webauthn_id } + end.to_not change(user, :webauthn_id) end end diff --git a/spec/models/admin/account_action_spec.rb b/spec/models/admin/account_action_spec.rb index 442815c889..df79d9f287 100644 --- a/spec/models/admin/account_action_spec.rb +++ b/spec/models/admin/account_action_spec.rb @@ -58,7 +58,7 @@ RSpec.describe Admin::AccountAction do it 'creates Admin::ActionLog' do expect do subject - end.to change { Admin::ActionLog.count }.by 1 + end.to change(Admin::ActionLog, :count).by 1 end it 'calls process_email!' do diff --git a/spec/services/suspend_account_service_spec.rb b/spec/services/suspend_account_service_spec.rb index 4489bfed57..f9206b7ea2 100644 --- a/spec/services/suspend_account_service_spec.rb +++ b/spec/services/suspend_account_service_spec.rb @@ -26,7 +26,7 @@ RSpec.describe SuspendAccountService, type: :service do end it 'does not change the “suspended” flag' do - expect { subject }.to_not change { account.suspended? } + expect { subject }.to_not change(account, :suspended?) end end diff --git a/spec/services/unsuspend_account_service_spec.rb b/spec/services/unsuspend_account_service_spec.rb index 80285cc12b..e02ae41b99 100644 --- a/spec/services/unsuspend_account_service_spec.rb +++ b/spec/services/unsuspend_account_service_spec.rb @@ -33,7 +33,7 @@ RSpec.describe UnsuspendAccountService, type: :service do end it 'does not change the “suspended” flag' do - expect { subject }.to_not change { account.suspended? } + expect { subject }.to_not change(account, :suspended?) end include_examples 'with common context' do @@ -86,7 +86,7 @@ RSpec.describe UnsuspendAccountService, type: :service do end it 'does not change the “suspended” flag' do - expect { subject }.to_not change { account.suspended? } + expect { subject }.to_not change(account, :suspended?) end end @@ -110,7 +110,7 @@ RSpec.describe UnsuspendAccountService, type: :service do end it 'marks account as suspended' do - expect { subject }.to change { account.suspended? }.from(false).to(true) + expect { subject }.to change(account, :suspended?).from(false).to(true) end end diff --git a/spec/workers/scheduler/accounts_statuses_cleanup_scheduler_spec.rb b/spec/workers/scheduler/accounts_statuses_cleanup_scheduler_spec.rb index 8e747d04f5..fb626596fe 100644 --- a/spec/workers/scheduler/accounts_statuses_cleanup_scheduler_spec.rb +++ b/spec/workers/scheduler/accounts_statuses_cleanup_scheduler_spec.rb @@ -103,7 +103,7 @@ describe Scheduler::AccountsStatusesCleanupScheduler do describe '#perform' do context 'when the budget is lower than the number of toots to delete' do it 'deletes as many statuses as the given budget' do - expect { subject.perform }.to change { Status.count }.by(-subject.compute_budget) + expect { subject.perform }.to change(Status, :count).by(-subject.compute_budget) end it 'does not delete from accounts with no cleanup policy' do @@ -117,7 +117,7 @@ describe Scheduler::AccountsStatusesCleanupScheduler do it 'eventually deletes every deletable toot given enough runs' do stub_const 'Scheduler::AccountsStatusesCleanupScheduler::MAX_BUDGET', 4 - expect { 10.times { subject.perform } }.to change { Status.count }.by(-30) + expect { 10.times { subject.perform } }.to change(Status, :count).by(-30) end it 'correctly round-trips between users across several runs' do @@ -125,7 +125,7 @@ describe Scheduler::AccountsStatusesCleanupScheduler do stub_const 'Scheduler::AccountsStatusesCleanupScheduler::PER_ACCOUNT_BUDGET', 2 expect { 3.times { subject.perform } } - .to change { Status.count }.by(-3 * 3) + .to change(Status, :count).by(-3 * 3) .and change { account1.statuses.count } .and change { account3.statuses.count } .and change { account5.statuses.count } @@ -140,7 +140,7 @@ describe Scheduler::AccountsStatusesCleanupScheduler do it 'correctly handles looping in a single run' do expect(subject.compute_budget).to eq(400) - expect { subject.perform }.to change { Status.count }.by(-30) + expect { subject.perform }.to change(Status, :count).by(-30) end end @@ -154,7 +154,7 @@ describe Scheduler::AccountsStatusesCleanupScheduler do it 'does not get stuck' do expect(subject.compute_budget).to eq(400) - expect { subject.perform }.to_not change { Status.count } + expect { subject.perform }.to_not change(Status, :count) end end end From 384345b0de9cc6b8cc62bbf60f2361449995717d Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Wed, 24 May 2023 05:55:40 -0400 Subject: [PATCH 15/17] Add CLI Base class for command line code (#25106) --- lib/mastodon/cli/accounts.rb | 12 ++------ lib/mastodon/cli/base.rb | 19 +++++++++++++ lib/mastodon/cli/cache.rb | 12 ++------ lib/mastodon/cli/canonical_email_blocks.rb | 12 ++------ lib/mastodon/cli/domains.rb | 12 ++------ lib/mastodon/cli/email_domain_blocks.rb | 12 ++------ lib/mastodon/cli/emoji.rb | 10 ++----- lib/mastodon/cli/feeds.rb | 11 ++------ lib/mastodon/cli/ip_blocks.rb | 10 ++----- lib/mastodon/cli/main.rb | 28 ++++++++----------- lib/mastodon/cli/maintenance.rb | 12 ++------ lib/mastodon/cli/media.rb | 11 ++------ lib/mastodon/cli/preview_cards.rb | 11 ++------ lib/mastodon/cli/search.rb | 8 ++---- lib/mastodon/cli/settings.rb | 12 ++------ lib/mastodon/cli/statuses.rb | 11 ++------ lib/mastodon/cli/upgrade.rb | 12 ++------ spec/lib/mastodon/cli/accounts_spec.rb | 12 ++++++++ spec/lib/mastodon/cli/cache_spec.rb | 12 ++++++++ .../cli/canonical_email_blocks_spec.rb | 12 ++++++++ spec/lib/mastodon/cli/domains_spec.rb | 12 ++++++++ .../mastodon/cli/email_domain_blocks_spec.rb | 12 ++++++++ spec/lib/mastodon/cli/emoji_spec.rb | 12 ++++++++ spec/lib/mastodon/cli/feeds_spec.rb | 12 ++++++++ spec/lib/mastodon/cli/ip_blocks_spec.rb | 8 +++++- spec/lib/mastodon/cli/main_spec.rb | 6 ++++ spec/lib/mastodon/cli/maintenance_spec.rb | 12 ++++++++ spec/lib/mastodon/cli/media_spec.rb | 12 ++++++++ spec/lib/mastodon/cli/preview_cards_spec.rb | 12 ++++++++ spec/lib/mastodon/cli/search_spec.rb | 12 ++++++++ spec/lib/mastodon/cli/settings_spec.rb | 8 +++++- spec/lib/mastodon/cli/statuses_spec.rb | 12 ++++++++ spec/lib/mastodon/cli/upgrade_spec.rb | 12 ++++++++ 33 files changed, 238 insertions(+), 155 deletions(-) create mode 100644 lib/mastodon/cli/base.rb create mode 100644 spec/lib/mastodon/cli/accounts_spec.rb create mode 100644 spec/lib/mastodon/cli/cache_spec.rb create mode 100644 spec/lib/mastodon/cli/canonical_email_blocks_spec.rb create mode 100644 spec/lib/mastodon/cli/domains_spec.rb create mode 100644 spec/lib/mastodon/cli/email_domain_blocks_spec.rb create mode 100644 spec/lib/mastodon/cli/emoji_spec.rb create mode 100644 spec/lib/mastodon/cli/feeds_spec.rb create mode 100644 spec/lib/mastodon/cli/maintenance_spec.rb create mode 100644 spec/lib/mastodon/cli/media_spec.rb create mode 100644 spec/lib/mastodon/cli/preview_cards_spec.rb create mode 100644 spec/lib/mastodon/cli/search_spec.rb create mode 100644 spec/lib/mastodon/cli/statuses_spec.rb create mode 100644 spec/lib/mastodon/cli/upgrade_spec.rb diff --git a/lib/mastodon/cli/accounts.rb b/lib/mastodon/cli/accounts.rb index a44f63db03..417f126ccd 100644 --- a/lib/mastodon/cli/accounts.rb +++ b/lib/mastodon/cli/accounts.rb @@ -1,18 +1,10 @@ # frozen_string_literal: true require 'set' -require_relative '../../../config/boot' -require_relative '../../../config/environment' -require_relative 'helper' +require_relative 'base' module Mastodon::CLI - class Accounts < Thor - include Helper - - def self.exit_on_failure? - true - end - + class Accounts < Base option :all, type: :boolean desc 'rotate [USERNAME]', 'Generate and broadcast new keys' long_desc <<-LONG_DESC diff --git a/lib/mastodon/cli/base.rb b/lib/mastodon/cli/base.rb new file mode 100644 index 0000000000..f3c9fea921 --- /dev/null +++ b/lib/mastodon/cli/base.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +require_relative '../../../config/boot' +require_relative '../../../config/environment' + +require 'thor' +require_relative 'helper' + +module Mastodon + module CLI + class Base < Thor + include CLI::Helper + + def self.exit_on_failure? + true + end + end + end +end diff --git a/lib/mastodon/cli/cache.rb b/lib/mastodon/cli/cache.rb index b0bf6aabd8..105d4b3c32 100644 --- a/lib/mastodon/cli/cache.rb +++ b/lib/mastodon/cli/cache.rb @@ -1,17 +1,9 @@ # frozen_string_literal: true -require_relative '../../../config/boot' -require_relative '../../../config/environment' -require_relative 'helper' +require_relative 'base' module Mastodon::CLI - class Cache < Thor - include Helper - - def self.exit_on_failure? - true - end - + class Cache < Base desc 'clear', 'Clear out the cache storage' def clear Rails.cache.clear diff --git a/lib/mastodon/cli/canonical_email_blocks.rb b/lib/mastodon/cli/canonical_email_blocks.rb index f3c427a2c7..dd5e6596dd 100644 --- a/lib/mastodon/cli/canonical_email_blocks.rb +++ b/lib/mastodon/cli/canonical_email_blocks.rb @@ -1,18 +1,10 @@ # frozen_string_literal: true require 'concurrent' -require_relative '../../../config/boot' -require_relative '../../../config/environment' -require_relative 'helper' +require_relative 'base' module Mastodon::CLI - class CanonicalEmailBlocks < Thor - include Helper - - def self.exit_on_failure? - true - end - + class CanonicalEmailBlocks < Base desc 'find EMAIL', 'Find a given e-mail address in the canonical e-mail blocks' long_desc <<-LONG_DESC When suspending a local user, a hash of a "canonical" version of their e-mail diff --git a/lib/mastodon/cli/domains.rb b/lib/mastodon/cli/domains.rb index 8b5f03ce0f..d885c95638 100644 --- a/lib/mastodon/cli/domains.rb +++ b/lib/mastodon/cli/domains.rb @@ -1,18 +1,10 @@ # frozen_string_literal: true require 'concurrent' -require_relative '../../../config/boot' -require_relative '../../../config/environment' -require_relative 'helper' +require_relative 'base' module Mastodon::CLI - class Domains < Thor - include Helper - - def self.exit_on_failure? - true - end - + class Domains < Base option :concurrency, type: :numeric, default: 5, aliases: [:c] option :verbose, type: :boolean, aliases: [:v] option :dry_run, type: :boolean diff --git a/lib/mastodon/cli/email_domain_blocks.rb b/lib/mastodon/cli/email_domain_blocks.rb index 6ef35cc8cf..abbbdfe31c 100644 --- a/lib/mastodon/cli/email_domain_blocks.rb +++ b/lib/mastodon/cli/email_domain_blocks.rb @@ -1,18 +1,10 @@ # frozen_string_literal: true require 'concurrent' -require_relative '../../../config/boot' -require_relative '../../../config/environment' -require_relative 'helper' +require_relative 'base' module Mastodon::CLI - class EmailDomainBlocks < Thor - include Helper - - def self.exit_on_failure? - true - end - + class EmailDomainBlocks < Base desc 'list', 'List blocked e-mail domains' def list EmailDomainBlock.where(parent_id: nil).order(id: 'DESC').find_each do |entry| diff --git a/lib/mastodon/cli/emoji.rb b/lib/mastodon/cli/emoji.rb index 9b41a59c29..912c099124 100644 --- a/lib/mastodon/cli/emoji.rb +++ b/lib/mastodon/cli/emoji.rb @@ -1,16 +1,10 @@ # frozen_string_literal: true require 'rubygems/package' -require_relative '../../../config/boot' -require_relative '../../../config/environment' -require_relative 'helper' +require_relative 'base' module Mastodon::CLI - class Emoji < Thor - def self.exit_on_failure? - true - end - + class Emoji < Base option :prefix option :suffix option :overwrite, type: :boolean diff --git a/lib/mastodon/cli/feeds.rb b/lib/mastodon/cli/feeds.rb index 4307b880f7..342b550ca3 100644 --- a/lib/mastodon/cli/feeds.rb +++ b/lib/mastodon/cli/feeds.rb @@ -1,18 +1,11 @@ # frozen_string_literal: true -require_relative '../../../config/boot' -require_relative '../../../config/environment' -require_relative 'helper' +require_relative 'base' module Mastodon::CLI - class Feeds < Thor - include Helper + class Feeds < Base include Redisable - def self.exit_on_failure? - true - end - option :all, type: :boolean, default: false option :concurrency, type: :numeric, default: 5, aliases: [:c] option :verbose, type: :boolean, aliases: [:v] diff --git a/lib/mastodon/cli/ip_blocks.rb b/lib/mastodon/cli/ip_blocks.rb index 561d64d182..d12919c360 100644 --- a/lib/mastodon/cli/ip_blocks.rb +++ b/lib/mastodon/cli/ip_blocks.rb @@ -1,16 +1,10 @@ # frozen_string_literal: true require 'rubygems/package' -require_relative '../../../config/boot' -require_relative '../../../config/environment' -require_relative 'helper' +require_relative 'base' module Mastodon::CLI - class IpBlocks < Thor - def self.exit_on_failure? - true - end - + class IpBlocks < Base option :severity, required: true, enum: %w(no_access sign_up_requires_approval sign_up_block), desc: 'Severity of the block' option :comment, aliases: [:c], desc: 'Optional comment' option :duration, aliases: [:d], type: :numeric, desc: 'Duration of the block in seconds' diff --git a/lib/mastodon/cli/main.rb b/lib/mastodon/cli/main.rb index 0f2236f78f..e61a6f9c46 100644 --- a/lib/mastodon/cli/main.rb +++ b/lib/mastodon/cli/main.rb @@ -1,29 +1,25 @@ # frozen_string_literal: true -require 'thor' -require_relative 'media' -require_relative 'emoji' +require_relative 'base' + require_relative 'accounts' +require_relative 'cache' +require_relative 'canonical_email_blocks' +require_relative 'domains' +require_relative 'email_domain_blocks' +require_relative 'emoji' require_relative 'feeds' +require_relative 'ip_blocks' +require_relative 'maintenance' +require_relative 'media' +require_relative 'preview_cards' require_relative 'search' require_relative 'settings' require_relative 'statuses' -require_relative 'domains' -require_relative 'preview_cards' -require_relative 'cache' require_relative 'upgrade' -require_relative 'email_domain_blocks' -require_relative 'canonical_email_blocks' -require_relative 'ip_blocks' -require_relative 'maintenance' -require_relative '../version' module Mastodon::CLI - class Main < Thor - def self.exit_on_failure? - true - end - + class Main < Base desc 'media SUBCOMMAND ...ARGS', 'Manage media files' subcommand 'media', Media diff --git a/lib/mastodon/cli/maintenance.rb b/lib/mastodon/cli/maintenance.rb index d9f1b02570..660adef80e 100644 --- a/lib/mastodon/cli/maintenance.rb +++ b/lib/mastodon/cli/maintenance.rb @@ -1,18 +1,10 @@ # frozen_string_literal: true require 'tty-prompt' -require_relative '../../../config/boot' -require_relative '../../../config/environment' -require_relative 'helper' +require_relative 'base' module Mastodon::CLI - class Maintenance < Thor - include Helper - - def self.exit_on_failure? - true - end - + class Maintenance < Base MIN_SUPPORTED_VERSION = 2019_10_01_213028 MAX_SUPPORTED_VERSION = 2022_11_04_133904 diff --git a/lib/mastodon/cli/media.rb b/lib/mastodon/cli/media.rb index 509c4ca264..045f6351ad 100644 --- a/lib/mastodon/cli/media.rb +++ b/lib/mastodon/cli/media.rb @@ -1,20 +1,13 @@ # frozen_string_literal: true -require_relative '../../../config/boot' -require_relative '../../../config/environment' -require_relative 'helper' +require_relative 'base' module Mastodon::CLI - class Media < Thor + class Media < Base include ActionView::Helpers::NumberHelper - include Helper VALID_PATH_SEGMENTS_SIZE = [7, 10].freeze - def self.exit_on_failure? - true - end - option :days, type: :numeric, default: 7, aliases: [:d] option :prune_profiles, type: :boolean, default: false option :remove_headers, type: :boolean, default: false diff --git a/lib/mastodon/cli/preview_cards.rb b/lib/mastodon/cli/preview_cards.rb index 794b25693a..c66bcb504a 100644 --- a/lib/mastodon/cli/preview_cards.rb +++ b/lib/mastodon/cli/preview_cards.rb @@ -1,18 +1,11 @@ # frozen_string_literal: true require 'tty-prompt' -require_relative '../../../config/boot' -require_relative '../../../config/environment' -require_relative 'helper' +require_relative 'base' module Mastodon::CLI - class PreviewCards < Thor + class PreviewCards < Base include ActionView::Helpers::NumberHelper - include Helper - - def self.exit_on_failure? - true - end option :days, type: :numeric, default: 180 option :concurrency, type: :numeric, default: 5, aliases: [:c] diff --git a/lib/mastodon/cli/search.rb b/lib/mastodon/cli/search.rb index ccece5b5f8..6f48dcb096 100644 --- a/lib/mastodon/cli/search.rb +++ b/lib/mastodon/cli/search.rb @@ -1,13 +1,9 @@ # frozen_string_literal: true -require_relative '../../../config/boot' -require_relative '../../../config/environment' -require_relative 'helper' +require_relative 'base' module Mastodon::CLI - class Search < Thor - include Helper - + class Search < Base # Indices are sorted by amount of data to be expected in each, so that # smaller indices can go online sooner INDICES = [ diff --git a/lib/mastodon/cli/settings.rb b/lib/mastodon/cli/settings.rb index 5869efc466..7d4c13b78e 100644 --- a/lib/mastodon/cli/settings.rb +++ b/lib/mastodon/cli/settings.rb @@ -1,15 +1,9 @@ # frozen_string_literal: true -require_relative '../../../config/boot' -require_relative '../../../config/environment' -require_relative 'helper' +require_relative 'base' module Mastodon::CLI - class Registrations < Thor - def self.exit_on_failure? - true - end - + class Registrations < Base desc 'open', 'Open registrations' def open Setting.registrations_mode = 'open' @@ -37,7 +31,7 @@ module Mastodon::CLI end end - class Settings < Thor + class Settings < Base desc 'registrations SUBCOMMAND ...ARGS', 'Manage state of registrations' subcommand 'registrations', Registrations end diff --git a/lib/mastodon/cli/statuses.rb b/lib/mastodon/cli/statuses.rb index e5eb759608..bd5b047077 100644 --- a/lib/mastodon/cli/statuses.rb +++ b/lib/mastodon/cli/statuses.rb @@ -1,18 +1,11 @@ # frozen_string_literal: true -require_relative '../../../config/boot' -require_relative '../../../config/environment' -require_relative 'helper' +require_relative 'base' module Mastodon::CLI - class Statuses < Thor - include Helper + class Statuses < Base include ActionView::Helpers::NumberHelper - def self.exit_on_failure? - true - end - option :days, type: :numeric, default: 90 option :batch_size, type: :numeric, default: 1_000, aliases: [:b], desc: 'Number of records in each batch' option :continue, type: :boolean, default: false, desc: 'If remove is not completed, execute from the previous continuation' diff --git a/lib/mastodon/cli/upgrade.rb b/lib/mastodon/cli/upgrade.rb index f20fa4cdf4..e5c86b3d73 100644 --- a/lib/mastodon/cli/upgrade.rb +++ b/lib/mastodon/cli/upgrade.rb @@ -1,17 +1,9 @@ # frozen_string_literal: true -require_relative '../../../config/boot' -require_relative '../../../config/environment' -require_relative 'helper' +require_relative 'base' module Mastodon::CLI - class Upgrade < Thor - include Helper - - def self.exit_on_failure? - true - end - + class Upgrade < Base CURRENT_STORAGE_SCHEMA_VERSION = 1 option :dry_run, type: :boolean, default: false diff --git a/spec/lib/mastodon/cli/accounts_spec.rb b/spec/lib/mastodon/cli/accounts_spec.rb new file mode 100644 index 0000000000..25f1311d40 --- /dev/null +++ b/spec/lib/mastodon/cli/accounts_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'rails_helper' +require 'mastodon/cli/accounts' + +describe Mastodon::CLI::Accounts do + describe '.exit_on_failure?' do + it 'returns true' do + expect(described_class.exit_on_failure?).to be true + end + end +end diff --git a/spec/lib/mastodon/cli/cache_spec.rb b/spec/lib/mastodon/cli/cache_spec.rb new file mode 100644 index 0000000000..f101bc200f --- /dev/null +++ b/spec/lib/mastodon/cli/cache_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'rails_helper' +require 'mastodon/cli/cache' + +describe Mastodon::CLI::Cache do + describe '.exit_on_failure?' do + it 'returns true' do + expect(described_class.exit_on_failure?).to be true + end + end +end diff --git a/spec/lib/mastodon/cli/canonical_email_blocks_spec.rb b/spec/lib/mastodon/cli/canonical_email_blocks_spec.rb new file mode 100644 index 0000000000..fb481e8a82 --- /dev/null +++ b/spec/lib/mastodon/cli/canonical_email_blocks_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'rails_helper' +require 'mastodon/cli/canonical_email_blocks' + +describe Mastodon::CLI::CanonicalEmailBlocks do + describe '.exit_on_failure?' do + it 'returns true' do + expect(described_class.exit_on_failure?).to be true + end + end +end diff --git a/spec/lib/mastodon/cli/domains_spec.rb b/spec/lib/mastodon/cli/domains_spec.rb new file mode 100644 index 0000000000..ea58845c00 --- /dev/null +++ b/spec/lib/mastodon/cli/domains_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'rails_helper' +require 'mastodon/cli/domains' + +describe Mastodon::CLI::Domains do + describe '.exit_on_failure?' do + it 'returns true' do + expect(described_class.exit_on_failure?).to be true + end + end +end diff --git a/spec/lib/mastodon/cli/email_domain_blocks_spec.rb b/spec/lib/mastodon/cli/email_domain_blocks_spec.rb new file mode 100644 index 0000000000..333ae3f2b7 --- /dev/null +++ b/spec/lib/mastodon/cli/email_domain_blocks_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'rails_helper' +require 'mastodon/cli/email_domain_blocks' + +describe Mastodon::CLI::EmailDomainBlocks do + describe '.exit_on_failure?' do + it 'returns true' do + expect(described_class.exit_on_failure?).to be true + end + end +end diff --git a/spec/lib/mastodon/cli/emoji_spec.rb b/spec/lib/mastodon/cli/emoji_spec.rb new file mode 100644 index 0000000000..9b58653729 --- /dev/null +++ b/spec/lib/mastodon/cli/emoji_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'rails_helper' +require 'mastodon/cli/emoji' + +describe Mastodon::CLI::Emoji do + describe '.exit_on_failure?' do + it 'returns true' do + expect(described_class.exit_on_failure?).to be true + end + end +end diff --git a/spec/lib/mastodon/cli/feeds_spec.rb b/spec/lib/mastodon/cli/feeds_spec.rb new file mode 100644 index 0000000000..4e1e214eff --- /dev/null +++ b/spec/lib/mastodon/cli/feeds_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'rails_helper' +require 'mastodon/cli/feeds' + +describe Mastodon::CLI::Feeds do + describe '.exit_on_failure?' do + it 'returns true' do + expect(described_class.exit_on_failure?).to be true + end + end +end diff --git a/spec/lib/mastodon/cli/ip_blocks_spec.rb b/spec/lib/mastodon/cli/ip_blocks_spec.rb index e7639d9aaf..e192679a59 100644 --- a/spec/lib/mastodon/cli/ip_blocks_spec.rb +++ b/spec/lib/mastodon/cli/ip_blocks_spec.rb @@ -3,9 +3,15 @@ require 'rails_helper' require 'mastodon/cli/ip_blocks' -RSpec.describe Mastodon::CLI::IpBlocks do +describe Mastodon::CLI::IpBlocks do let(:cli) { described_class.new } + describe '.exit_on_failure?' do + it 'returns true' do + expect(described_class.exit_on_failure?).to be true + end + end + describe '#add' do let(:ip_list) do [ diff --git a/spec/lib/mastodon/cli/main_spec.rb b/spec/lib/mastodon/cli/main_spec.rb index 105c4ec371..e3709afe37 100644 --- a/spec/lib/mastodon/cli/main_spec.rb +++ b/spec/lib/mastodon/cli/main_spec.rb @@ -4,6 +4,12 @@ require 'rails_helper' require 'mastodon/cli/main' describe Mastodon::CLI::Main do + describe '.exit_on_failure?' do + it 'returns true' do + expect(described_class.exit_on_failure?).to be true + end + end + describe 'version' do it 'returns the Mastodon version' do expect { described_class.new.invoke(:version) }.to output( diff --git a/spec/lib/mastodon/cli/maintenance_spec.rb b/spec/lib/mastodon/cli/maintenance_spec.rb new file mode 100644 index 0000000000..12cd9ca8a6 --- /dev/null +++ b/spec/lib/mastodon/cli/maintenance_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'rails_helper' +require 'mastodon/cli/maintenance' + +describe Mastodon::CLI::Maintenance do + describe '.exit_on_failure?' do + it 'returns true' do + expect(described_class.exit_on_failure?).to be true + end + end +end diff --git a/spec/lib/mastodon/cli/media_spec.rb b/spec/lib/mastodon/cli/media_spec.rb new file mode 100644 index 0000000000..29f7d424a9 --- /dev/null +++ b/spec/lib/mastodon/cli/media_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'rails_helper' +require 'mastodon/cli/media' + +describe Mastodon::CLI::Media do + describe '.exit_on_failure?' do + it 'returns true' do + expect(described_class.exit_on_failure?).to be true + end + end +end diff --git a/spec/lib/mastodon/cli/preview_cards_spec.rb b/spec/lib/mastodon/cli/preview_cards_spec.rb new file mode 100644 index 0000000000..b4b018b3be --- /dev/null +++ b/spec/lib/mastodon/cli/preview_cards_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'rails_helper' +require 'mastodon/cli/preview_cards' + +describe Mastodon::CLI::PreviewCards do + describe '.exit_on_failure?' do + it 'returns true' do + expect(described_class.exit_on_failure?).to be true + end + end +end diff --git a/spec/lib/mastodon/cli/search_spec.rb b/spec/lib/mastodon/cli/search_spec.rb new file mode 100644 index 0000000000..d5cae5bf49 --- /dev/null +++ b/spec/lib/mastodon/cli/search_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'rails_helper' +require 'mastodon/cli/search' + +describe Mastodon::CLI::Search do + describe '.exit_on_failure?' do + it 'returns true' do + expect(described_class.exit_on_failure?).to be true + end + end +end diff --git a/spec/lib/mastodon/cli/settings_spec.rb b/spec/lib/mastodon/cli/settings_spec.rb index 01f0775628..ae58e74e56 100644 --- a/spec/lib/mastodon/cli/settings_spec.rb +++ b/spec/lib/mastodon/cli/settings_spec.rb @@ -3,7 +3,13 @@ require 'rails_helper' require 'mastodon/cli/settings' -RSpec.describe Mastodon::CLI::Settings do +describe Mastodon::CLI::Settings do + describe '.exit_on_failure?' do + it 'returns true' do + expect(described_class.exit_on_failure?).to be true + end + end + describe 'subcommand "registrations"' do let(:cli) { Mastodon::CLI::Registrations.new } diff --git a/spec/lib/mastodon/cli/statuses_spec.rb b/spec/lib/mastodon/cli/statuses_spec.rb new file mode 100644 index 0000000000..2430a88416 --- /dev/null +++ b/spec/lib/mastodon/cli/statuses_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'rails_helper' +require 'mastodon/cli/statuses' + +describe Mastodon::CLI::Statuses do + describe '.exit_on_failure?' do + it 'returns true' do + expect(described_class.exit_on_failure?).to be true + end + end +end diff --git a/spec/lib/mastodon/cli/upgrade_spec.rb b/spec/lib/mastodon/cli/upgrade_spec.rb new file mode 100644 index 0000000000..9e0ab9d06e --- /dev/null +++ b/spec/lib/mastodon/cli/upgrade_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'rails_helper' +require 'mastodon/cli/upgrade' + +describe Mastodon::CLI::Upgrade do + describe '.exit_on_failure?' do + it 'returns true' do + expect(described_class.exit_on_failure?).to be true + end + end +end From 391c089d0db58d731765dba730a5e1f2fe8570a6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 May 2023 12:38:08 +0200 Subject: [PATCH 16/17] Bump eslint from 8.40.0 to 8.41.0 (#25081) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 31 +++++++++++++++---------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index f28acea2c4..13720c56b4 100644 --- a/package.json +++ b/package.json @@ -177,7 +177,7 @@ "@typescript-eslint/eslint-plugin": "^5.59.7", "@typescript-eslint/parser": "^5.59.7", "babel-jest": "^29.5.0", - "eslint": "^8.40.0", + "eslint": "^8.41.0", "eslint-config-prettier": "^8.8.0", "eslint-import-resolver-typescript": "^3.5.5", "eslint-plugin-formatjs": "^4.10.1", diff --git a/yarn.lock b/yarn.lock index ca7a998abb..ae89f81d37 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1252,10 +1252,10 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@8.40.0": - version "8.40.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.40.0.tgz#3ba73359e11f5a7bd3e407f70b3528abfae69cec" - integrity sha512-ElyB54bJIhXQYVKjDSvCkPO1iU1tSAeVQJbllWJq1XQSmmA4dgFk8CbiBGpiOPxleE48vDogxCtmMYku4HSVLA== +"@eslint/js@8.41.0": + version "8.41.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.41.0.tgz#080321c3b68253522f7646b55b577dd99d2950b3" + integrity sha512-LxcyMGxwmTh2lY9FwHPGWOHmYFCZvbrFCBZL4FzSSsxsRPuhrYUg/49/0KDfW8tnIEaEHtfmn6+NPN+1DqaNmA== "@floating-ui/core@^1.0.1": version "1.0.1" @@ -5178,15 +5178,15 @@ eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz#c22c48f48942d08ca824cc526211ae400478a994" integrity sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA== -eslint@^8.40.0: - version "8.40.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.40.0.tgz#a564cd0099f38542c4e9a2f630fa45bf33bc42a4" - integrity sha512-bvR+TsP9EHL3TqNtj9sCNJVAFK3fBN8Q7g5waghxyRsPLIMwL73XSKnZFK0hk/O2ANC+iAoq6PWMQ+IfBAJIiQ== +eslint@^8.41.0: + version "8.41.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.41.0.tgz#3062ca73363b4714b16dbc1e60f035e6134b6f1c" + integrity sha512-WQDQpzGBOP5IrXPo4Hc0814r4/v2rrIsB0rhT7jtunIalgg6gYXWhRMOejVO8yH21T/FGaxjmFjBMNqcIlmH1Q== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@eslint-community/regexpp" "^4.4.0" "@eslint/eslintrc" "^2.0.3" - "@eslint/js" "8.40.0" + "@eslint/js" "8.41.0" "@humanwhocodes/config-array" "^0.11.8" "@humanwhocodes/module-importer" "^1.0.1" "@nodelib/fs.walk" "^1.2.8" @@ -5206,13 +5206,12 @@ eslint@^8.40.0: find-up "^5.0.0" glob-parent "^6.0.2" globals "^13.19.0" - grapheme-splitter "^1.0.4" + graphemer "^1.4.0" ignore "^5.2.0" import-fresh "^3.0.0" imurmurhash "^0.1.4" is-glob "^4.0.0" is-path-inside "^3.0.3" - js-sdsl "^4.1.4" js-yaml "^4.1.0" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.4.1" @@ -5993,6 +5992,11 @@ grapheme-splitter@^1.0.4: resolved "https://registry.yarnpkg.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e" integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ== +graphemer@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" + integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== + gzip-size@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-6.0.0.tgz#065367fd50c239c0671cbcbad5be3e2eeb10e462" @@ -7399,11 +7403,6 @@ jpeg-js@^0.4.2: resolved "https://registry.yarnpkg.com/jpeg-js/-/jpeg-js-0.4.4.tgz#a9f1c6f1f9f0fa80cdb3484ed9635054d28936aa" integrity sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg== -js-sdsl@^4.1.4: - version "4.3.0" - resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.3.0.tgz#aeefe32a451f7af88425b11fdb5f58c90ae1d711" - integrity sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ== - "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" From e58c36d308f7e7e26154837d53da0185a0db7f16 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Wed, 24 May 2023 12:38:50 +0200 Subject: [PATCH 17/17] Update inconsistent `defaultMessage` (#25114) --- .../mastodon/components/account.jsx | 2 +- app/javascript/mastodon/components/status.jsx | 2 +- .../mastodon/containers/domain_container.jsx | 2 +- .../mastodon/containers/status_container.jsx | 2 +- .../containers/header_container.jsx | 2 +- .../compose/components/action_bar.jsx | 2 +- .../features/getting_started/index.jsx | 2 +- .../report/components/status_check_box.jsx | 2 +- .../features/status/components/action_bar.jsx | 4 +-- .../status/components/detailed_status.jsx | 4 +-- .../mastodon/features/status/index.jsx | 2 +- .../features/ui/components/boost_modal.jsx | 4 +-- .../mastodon/locales/defaultMessages.json | 30 +++++++++---------- 13 files changed, 30 insertions(+), 30 deletions(-) diff --git a/app/javascript/mastodon/components/account.jsx b/app/javascript/mastodon/components/account.jsx index 07cb72be98..68a456c1b1 100644 --- a/app/javascript/mastodon/components/account.jsx +++ b/app/javascript/mastodon/components/account.jsx @@ -23,7 +23,7 @@ import { RelativeTimestamp } from './relative_timestamp'; const messages = defineMessages({ follow: { id: 'account.follow', defaultMessage: 'Follow' }, unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' }, - requested: { id: 'account.requested', defaultMessage: 'Awaiting approval' }, + requested: { id: 'account.requested', defaultMessage: 'Awaiting approval. Click to cancel follow request' }, unblock: { id: 'account.unblock', defaultMessage: 'Unblock @{name}' }, unmute: { id: 'account.unmute', defaultMessage: 'Unmute @{name}' }, mute_notifications: { id: 'account.mute_notifications', defaultMessage: 'Mute notifications from @{name}' }, diff --git a/app/javascript/mastodon/components/status.jsx b/app/javascript/mastodon/components/status.jsx index d8a21f64a0..3f3c292ea3 100644 --- a/app/javascript/mastodon/components/status.jsx +++ b/app/javascript/mastodon/components/status.jsx @@ -59,7 +59,7 @@ export const defaultMediaVisibility = (status) => { const messages = defineMessages({ public_short: { id: 'privacy.public.short', defaultMessage: 'Public' }, unlisted_short: { id: 'privacy.unlisted.short', defaultMessage: 'Unlisted' }, - private_short: { id: 'privacy.private.short', defaultMessage: 'Followers-only' }, + private_short: { id: 'privacy.private.short', defaultMessage: 'Followers only' }, direct_short: { id: 'privacy.direct.short', defaultMessage: 'Mentioned people only' }, edited: { id: 'status.edited', defaultMessage: 'Edited {date}' }, }); diff --git a/app/javascript/mastodon/containers/domain_container.jsx b/app/javascript/mastodon/containers/domain_container.jsx index 4828445c48..9a55b72cc3 100644 --- a/app/javascript/mastodon/containers/domain_container.jsx +++ b/app/javascript/mastodon/containers/domain_container.jsx @@ -19,7 +19,7 @@ const makeMapStateToProps = () => { const mapDispatchToProps = (dispatch, { intl }) => ({ onBlockDomain (domain) { dispatch(openModal('CONFIRM', { - message: {domain} }} />, + message: {domain} }} />, confirm: intl.formatMessage(messages.blockDomainConfirm), onConfirm: () => dispatch(blockDomain(domain)), })); diff --git a/app/javascript/mastodon/containers/status_container.jsx b/app/javascript/mastodon/containers/status_container.jsx index 5e5f75d092..2d4baafa1b 100644 --- a/app/javascript/mastodon/containers/status_container.jsx +++ b/app/javascript/mastodon/containers/status_container.jsx @@ -59,7 +59,7 @@ const messages = defineMessages({ replyMessage: { id: 'confirmations.reply.message', defaultMessage: 'Replying now will overwrite the message you are currently composing. Are you sure you want to proceed?' }, editConfirm: { id: 'confirmations.edit.confirm', defaultMessage: 'Edit' }, editMessage: { id: 'confirmations.edit.message', defaultMessage: 'Editing now will overwrite the message you are currently composing. Are you sure you want to proceed?' }, - blockDomainConfirm: { id: 'confirmations.domain_block.confirm', defaultMessage: 'Hide entire domain' }, + blockDomainConfirm: { id: 'confirmations.domain_block.confirm', defaultMessage: 'Block entire domain' }, }); const makeMapStateToProps = () => { diff --git a/app/javascript/mastodon/features/account_timeline/containers/header_container.jsx b/app/javascript/mastodon/features/account_timeline/containers/header_container.jsx index 6cb8a105cc..6442a4f82f 100644 --- a/app/javascript/mastodon/features/account_timeline/containers/header_container.jsx +++ b/app/javascript/mastodon/features/account_timeline/containers/header_container.jsx @@ -28,7 +28,7 @@ import Header from '../components/header'; const messages = defineMessages({ cancelFollowRequestConfirm: { id: 'confirmations.cancel_follow_request.confirm', defaultMessage: 'Withdraw request' }, unfollowConfirm: { id: 'confirmations.unfollow.confirm', defaultMessage: 'Unfollow' }, - blockDomainConfirm: { id: 'confirmations.domain_block.confirm', defaultMessage: 'Hide entire domain' }, + blockDomainConfirm: { id: 'confirmations.domain_block.confirm', defaultMessage: 'Block entire domain' }, }); const makeMapStateToProps = () => { diff --git a/app/javascript/mastodon/features/compose/components/action_bar.jsx b/app/javascript/mastodon/features/compose/components/action_bar.jsx index 60914b4626..726b5aa30d 100644 --- a/app/javascript/mastodon/features/compose/components/action_bar.jsx +++ b/app/javascript/mastodon/features/compose/components/action_bar.jsx @@ -16,7 +16,7 @@ const messages = defineMessages({ lists: { id: 'navigation_bar.lists', defaultMessage: 'Lists' }, followed_tags: { id: 'navigation_bar.followed_tags', defaultMessage: 'Followed hashtags' }, blocks: { id: 'navigation_bar.blocks', defaultMessage: 'Blocked users' }, - domain_blocks: { id: 'navigation_bar.domain_blocks', defaultMessage: 'Hidden domains' }, + domain_blocks: { id: 'navigation_bar.domain_blocks', defaultMessage: 'Blocked domains' }, mutes: { id: 'navigation_bar.mutes', defaultMessage: 'Muted users' }, filters: { id: 'navigation_bar.filters', defaultMessage: 'Muted words' }, logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' }, diff --git a/app/javascript/mastodon/features/getting_started/index.jsx b/app/javascript/mastodon/features/getting_started/index.jsx index 2d1ac6670d..e31ca79af1 100644 --- a/app/javascript/mastodon/features/getting_started/index.jsx +++ b/app/javascript/mastodon/features/getting_started/index.jsx @@ -34,7 +34,7 @@ const messages = defineMessages({ follow_requests: { id: 'navigation_bar.follow_requests', defaultMessage: 'Follow requests' }, favourites: { id: 'navigation_bar.favourites', defaultMessage: 'Favourites' }, blocks: { id: 'navigation_bar.blocks', defaultMessage: 'Blocked users' }, - domain_blocks: { id: 'navigation_bar.domain_blocks', defaultMessage: 'Hidden domains' }, + domain_blocks: { id: 'navigation_bar.domain_blocks', defaultMessage: 'Blocked domains' }, mutes: { id: 'navigation_bar.mutes', defaultMessage: 'Muted users' }, pins: { id: 'navigation_bar.pins', defaultMessage: 'Pinned posts' }, lists: { id: 'navigation_bar.lists', defaultMessage: 'Lists' }, diff --git a/app/javascript/mastodon/features/report/components/status_check_box.jsx b/app/javascript/mastodon/features/report/components/status_check_box.jsx index c22745ee5d..8125b5b3bb 100644 --- a/app/javascript/mastodon/features/report/components/status_check_box.jsx +++ b/app/javascript/mastodon/features/report/components/status_check_box.jsx @@ -17,7 +17,7 @@ import Option from './option'; const messages = defineMessages({ public_short: { id: 'privacy.public.short', defaultMessage: 'Public' }, unlisted_short: { id: 'privacy.unlisted.short', defaultMessage: 'Unlisted' }, - private_short: { id: 'privacy.private.short', defaultMessage: 'Followers-only' }, + private_short: { id: 'privacy.private.short', defaultMessage: 'Followers only' }, direct_short: { id: 'privacy.direct.short', defaultMessage: 'Mentioned people only' }, }); diff --git a/app/javascript/mastodon/features/status/components/action_bar.jsx b/app/javascript/mastodon/features/status/components/action_bar.jsx index bd565c72c6..2ce94d9d84 100644 --- a/app/javascript/mastodon/features/status/components/action_bar.jsx +++ b/app/javascript/mastodon/features/status/components/action_bar.jsx @@ -38,9 +38,9 @@ const messages = defineMessages({ unpin: { id: 'status.unpin', defaultMessage: 'Unpin from profile' }, embed: { id: 'status.embed', defaultMessage: 'Embed' }, admin_account: { id: 'status.admin_account', defaultMessage: 'Open moderation interface for @{name}' }, - admin_status: { id: 'status.admin_status', defaultMessage: 'Open this status in the moderation interface' }, + admin_status: { id: 'status.admin_status', defaultMessage: 'Open this post in the moderation interface' }, admin_domain: { id: 'status.admin_domain', defaultMessage: 'Open moderation interface for {domain}' }, - copy: { id: 'status.copy', defaultMessage: 'Copy link to status' }, + copy: { id: 'status.copy', defaultMessage: 'Copy link to post' }, blockDomain: { id: 'account.block_domain', defaultMessage: 'Block domain {domain}' }, unblockDomain: { id: 'account.unblock_domain', defaultMessage: 'Unblock domain {domain}' }, unmute: { id: 'account.unmute', defaultMessage: 'Unmute @{name}' }, diff --git a/app/javascript/mastodon/features/status/components/detailed_status.jsx b/app/javascript/mastodon/features/status/components/detailed_status.jsx index 00fd0d2cd6..187e04ad17 100644 --- a/app/javascript/mastodon/features/status/components/detailed_status.jsx +++ b/app/javascript/mastodon/features/status/components/detailed_status.jsx @@ -26,8 +26,8 @@ import Card from './card'; const messages = defineMessages({ public_short: { id: 'privacy.public.short', defaultMessage: 'Public' }, unlisted_short: { id: 'privacy.unlisted.short', defaultMessage: 'Unlisted' }, - private_short: { id: 'privacy.private.short', defaultMessage: 'Followers-only' }, - direct_short: { id: 'privacy.direct.short', defaultMessage: 'Direct' }, + private_short: { id: 'privacy.private.short', defaultMessage: 'Followers only' }, + direct_short: { id: 'privacy.direct.short', defaultMessage: 'Mentioned people only' }, }); class DetailedStatus extends ImmutablePureComponent { diff --git a/app/javascript/mastodon/features/status/index.jsx b/app/javascript/mastodon/features/status/index.jsx index 4c41958aae..1d26f7a69d 100644 --- a/app/javascript/mastodon/features/status/index.jsx +++ b/app/javascript/mastodon/features/status/index.jsx @@ -79,7 +79,7 @@ const messages = defineMessages({ detailedStatus: { id: 'status.detailed_status', defaultMessage: 'Detailed conversation view' }, replyConfirm: { id: 'confirmations.reply.confirm', defaultMessage: 'Reply' }, replyMessage: { id: 'confirmations.reply.message', defaultMessage: 'Replying now will overwrite the message you are currently composing. Are you sure you want to proceed?' }, - blockDomainConfirm: { id: 'confirmations.domain_block.confirm', defaultMessage: 'Hide entire domain' }, + blockDomainConfirm: { id: 'confirmations.domain_block.confirm', defaultMessage: 'Block entire domain' }, }); const makeMapStateToProps = () => { diff --git a/app/javascript/mastodon/features/ui/components/boost_modal.jsx b/app/javascript/mastodon/features/ui/components/boost_modal.jsx index af6c08134a..ee87cf2cdc 100644 --- a/app/javascript/mastodon/features/ui/components/boost_modal.jsx +++ b/app/javascript/mastodon/features/ui/components/boost_modal.jsx @@ -24,8 +24,8 @@ const messages = defineMessages({ reblog: { id: 'status.reblog', defaultMessage: 'Boost' }, public_short: { id: 'privacy.public.short', defaultMessage: 'Public' }, unlisted_short: { id: 'privacy.unlisted.short', defaultMessage: 'Unlisted' }, - private_short: { id: 'privacy.private.short', defaultMessage: 'Followers-only' }, - direct_short: { id: 'privacy.direct.short', defaultMessage: 'Direct' }, + private_short: { id: 'privacy.private.short', defaultMessage: 'Followers only' }, + direct_short: { id: 'privacy.direct.short', defaultMessage: 'Mentioned people only' }, }); const mapStateToProps = state => { diff --git a/app/javascript/mastodon/locales/defaultMessages.json b/app/javascript/mastodon/locales/defaultMessages.json index c64a970ead..d446989ab6 100644 --- a/app/javascript/mastodon/locales/defaultMessages.json +++ b/app/javascript/mastodon/locales/defaultMessages.json @@ -57,7 +57,7 @@ "id": "account.unfollow" }, { - "defaultMessage": "Awaiting approval", + "defaultMessage": "Awaiting approval. Click to cancel follow request", "id": "account.requested" }, { @@ -721,7 +721,7 @@ "id": "privacy.unlisted.short" }, { - "defaultMessage": "Followers-only", + "defaultMessage": "Followers only", "id": "privacy.private.short" }, { @@ -792,7 +792,7 @@ "id": "confirmations.domain_block.confirm" }, { - "defaultMessage": "Are you really, really sure you want to block the entire {domain}? In most cases a few targeted blocks or mutes are sufficient and preferable.", + "defaultMessage": "Are you really, really sure you want to block the entire {domain}? In most cases a few targeted blocks or mutes are sufficient and preferable. You will not see content from that domain in any public timelines or your notifications. Your followers from that domain will be removed.", "id": "confirmations.domain_block.message" } ], @@ -833,7 +833,7 @@ "id": "confirmations.edit.message" }, { - "defaultMessage": "Hide entire domain", + "defaultMessage": "Block entire domain", "id": "confirmations.domain_block.confirm" }, { @@ -980,7 +980,7 @@ "id": "confirmations.unfollow.confirm" }, { - "defaultMessage": "Hide entire domain", + "defaultMessage": "Block entire domain", "id": "confirmations.domain_block.confirm" }, { @@ -1412,7 +1412,7 @@ "id": "navigation_bar.blocks" }, { - "defaultMessage": "Hidden domains", + "defaultMessage": "Blocked domains", "id": "navigation_bar.domain_blocks" }, { @@ -2430,7 +2430,7 @@ "id": "navigation_bar.blocks" }, { - "defaultMessage": "Hidden domains", + "defaultMessage": "Blocked domains", "id": "navigation_bar.domain_blocks" }, { @@ -3535,7 +3535,7 @@ "id": "privacy.unlisted.short" }, { - "defaultMessage": "Followers-only", + "defaultMessage": "Followers only", "id": "privacy.private.short" }, { @@ -3743,7 +3743,7 @@ "id": "status.admin_account" }, { - "defaultMessage": "Open this status in the moderation interface", + "defaultMessage": "Open this post in the moderation interface", "id": "status.admin_status" }, { @@ -3751,7 +3751,7 @@ "id": "status.admin_domain" }, { - "defaultMessage": "Copy link to status", + "defaultMessage": "Copy link to post", "id": "status.copy" }, { @@ -3797,11 +3797,11 @@ "id": "privacy.unlisted.short" }, { - "defaultMessage": "Followers-only", + "defaultMessage": "Followers only", "id": "privacy.private.short" }, { - "defaultMessage": "Direct", + "defaultMessage": "Mentioned people only", "id": "privacy.direct.short" }, { @@ -3854,7 +3854,7 @@ "id": "confirmations.reply.message" }, { - "defaultMessage": "Hide entire domain", + "defaultMessage": "Block entire domain", "id": "confirmations.domain_block.confirm" }, { @@ -3925,11 +3925,11 @@ "id": "privacy.unlisted.short" }, { - "defaultMessage": "Followers-only", + "defaultMessage": "Followers only", "id": "privacy.private.short" }, { - "defaultMessage": "Direct", + "defaultMessage": "Mentioned people only", "id": "privacy.direct.short" }, {