From 8ef09813a2b46d99fe9c7e39beba2a68052c17d1 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Sun, 19 Feb 2023 20:18:54 -0500 Subject: Autofix Rubocop Style/EmptyMethod (#23732) --- .rubocop_todo.yml | 10 ---------- db/migrate/20181024224956_migrate_account_conversations.rb | 3 +-- .../20190529143559_preserve_old_layout_for_existing_users.rb | 3 +-- db/migrate/20200510110808_reset_web_app_secret.rb | 3 +-- 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index c3a62c2d9..6fb471600 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -2695,16 +2695,6 @@ Style/ConcatArrayLiterals: Style/Documentation: Enabled: false -# Offense count: 3 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: compact, expanded -Style/EmptyMethod: - Exclude: - - 'db/migrate/20181024224956_migrate_account_conversations.rb' - - 'db/migrate/20190529143559_preserve_old_layout_for_existing_users.rb' - - 'db/migrate/20200510110808_reset_web_app_secret.rb' - # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). Style/ExplicitBlockArgument: diff --git a/db/migrate/20181024224956_migrate_account_conversations.rb b/db/migrate/20181024224956_migrate_account_conversations.rb index 9e6497d81..aca6638e1 100644 --- a/db/migrate/20181024224956_migrate_account_conversations.rb +++ b/db/migrate/20181024224956_migrate_account_conversations.rb @@ -100,8 +100,7 @@ class MigrateAccountConversations < ActiveRecord::Migration[5.2] end end - def down - end + def down; end private diff --git a/db/migrate/20190529143559_preserve_old_layout_for_existing_users.rb b/db/migrate/20190529143559_preserve_old_layout_for_existing_users.rb index 72b7c609d..19e86fbfe 100644 --- a/db/migrate/20190529143559_preserve_old_layout_for_existing_users.rb +++ b/db/migrate/20190529143559_preserve_old_layout_for_existing_users.rb @@ -12,6 +12,5 @@ class PreserveOldLayoutForExistingUsers < ActiveRecord::Migration[5.2] end end - def down - end + def down; end end diff --git a/db/migrate/20200510110808_reset_web_app_secret.rb b/db/migrate/20200510110808_reset_web_app_secret.rb index b274844c5..8c0c06a83 100644 --- a/db/migrate/20200510110808_reset_web_app_secret.rb +++ b/db/migrate/20200510110808_reset_web_app_secret.rb @@ -10,6 +10,5 @@ class ResetWebAppSecret < ActiveRecord::Migration[5.2] web_app.save! end - def down - end + def down; end end -- cgit From 597767a9f7ca846be9fbca826aba362f8387a60f Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Sun, 19 Feb 2023 20:19:40 -0500 Subject: Autofix Rubocop Rails/RedundantForeignKey (#23731) --- .rubocop_todo.yml | 12 ------------ app/models/custom_filter.rb | 4 ++-- app/models/follow_recommendation.rb | 2 +- app/models/report.rb | 2 +- app/models/status.rb | 2 +- app/models/user_ip.rb | 2 +- db/post_migrate/20221101190723_backfill_admin_action_logs.rb | 2 +- .../20221206114142_backfill_admin_action_logs_again.rb | 2 +- 8 files changed, 8 insertions(+), 20 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 6fb471600..1a524e6fd 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -2459,18 +2459,6 @@ Rails/RakeEnvironment: - 'lib/tasks/repo.rake' - 'lib/tasks/statistics.rake' -# Offense count: 8 -# This cop supports safe autocorrection (--autocorrect). -Rails/RedundantForeignKey: - Exclude: - - 'app/models/custom_filter.rb' - - 'app/models/follow_recommendation.rb' - - 'app/models/report.rb' - - 'app/models/status.rb' - - 'app/models/user_ip.rb' - - 'db/post_migrate/20221101190723_backfill_admin_action_logs.rb' - - 'db/post_migrate/20221206114142_backfill_admin_action_logs_again.rb' - # Offense count: 29 # Configuration parameters: Include. # Include: db/**/*.rb diff --git a/app/models/custom_filter.rb b/app/models/custom_filter.rb index 5a4a974be..b70e53bd5 100644 --- a/app/models/custom_filter.rb +++ b/app/models/custom_filter.rb @@ -33,8 +33,8 @@ class CustomFilter < ApplicationRecord enum action: [:warn, :hide], _suffix: :action belongs_to :account - has_many :keywords, class_name: 'CustomFilterKeyword', foreign_key: :custom_filter_id, inverse_of: :custom_filter, dependent: :destroy - has_many :statuses, class_name: 'CustomFilterStatus', foreign_key: :custom_filter_id, inverse_of: :custom_filter, dependent: :destroy + has_many :keywords, class_name: 'CustomFilterKeyword', inverse_of: :custom_filter, dependent: :destroy + has_many :statuses, class_name: 'CustomFilterStatus', inverse_of: :custom_filter, dependent: :destroy accepts_nested_attributes_for :keywords, reject_if: :all_blank, allow_destroy: true validates :title, :context, presence: true diff --git a/app/models/follow_recommendation.rb b/app/models/follow_recommendation.rb index e552b5a88..501f8ecb6 100644 --- a/app/models/follow_recommendation.rb +++ b/app/models/follow_recommendation.rb @@ -12,7 +12,7 @@ class FollowRecommendation < ApplicationRecord self.primary_key = :account_id belongs_to :account_summary, foreign_key: :account_id - belongs_to :account, foreign_key: :account_id + belongs_to :account scope :localized, ->(locale) { joins(:account_summary).merge(AccountSummary.localized(locale)) } diff --git a/app/models/report.rb b/app/models/report.rb index 525d22ad5..fe6c292c5 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -32,7 +32,7 @@ class Report < ApplicationRecord belongs_to :action_taken_by_account, class_name: 'Account', optional: true belongs_to :assigned_account, class_name: 'Account', optional: true - has_many :notes, class_name: 'ReportNote', foreign_key: :report_id, inverse_of: :report, dependent: :destroy + has_many :notes, class_name: 'ReportNote', inverse_of: :report, dependent: :destroy has_many :notifications, as: :activity, dependent: :destroy scope :unresolved, -> { where(action_taken_at: nil) } diff --git a/app/models/status.rb b/app/models/status.rb index 102dfa994..e0ad29103 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -53,7 +53,7 @@ class Status < ApplicationRecord belongs_to :application, class_name: 'Doorkeeper::Application', optional: true belongs_to :account, inverse_of: :statuses - belongs_to :in_reply_to_account, foreign_key: 'in_reply_to_account_id', class_name: 'Account', optional: true + belongs_to :in_reply_to_account, class_name: 'Account', optional: true belongs_to :conversation, optional: true belongs_to :preloadable_poll, class_name: 'Poll', foreign_key: 'poll_id', optional: true diff --git a/app/models/user_ip.rb b/app/models/user_ip.rb index a8e802e13..1da615762 100644 --- a/app/models/user_ip.rb +++ b/app/models/user_ip.rb @@ -11,7 +11,7 @@ class UserIp < ApplicationRecord self.primary_key = :user_id - belongs_to :user, foreign_key: :user_id + belongs_to :user def readonly? true diff --git a/db/post_migrate/20221101190723_backfill_admin_action_logs.rb b/db/post_migrate/20221101190723_backfill_admin_action_logs.rb index 48ef1e6e3..6ab76a8f7 100644 --- a/db/post_migrate/20221101190723_backfill_admin_action_logs.rb +++ b/db/post_migrate/20221101190723_backfill_admin_action_logs.rb @@ -62,7 +62,7 @@ class BackfillAdminActionLogs < ActiveRecord::Migration[6.1] # Cannot use usual polymorphic support because of namespacing issues belongs_to :status, foreign_key: :target_id belongs_to :account, foreign_key: :target_id - belongs_to :user, foreign_key: :user_id + belongs_to :user belongs_to :domain_block, foreign_key: :target_id belongs_to :domain_allow, foreign_key: :target_id belongs_to :email_domain_block, foreign_key: :target_id diff --git a/db/post_migrate/20221206114142_backfill_admin_action_logs_again.rb b/db/post_migrate/20221206114142_backfill_admin_action_logs_again.rb index 279053ab9..42b7f3625 100644 --- a/db/post_migrate/20221206114142_backfill_admin_action_logs_again.rb +++ b/db/post_migrate/20221206114142_backfill_admin_action_logs_again.rb @@ -62,7 +62,7 @@ class BackfillAdminActionLogsAgain < ActiveRecord::Migration[6.1] # Cannot use usual polymorphic support because of namespacing issues belongs_to :status, foreign_key: :target_id belongs_to :account, foreign_key: :target_id - belongs_to :user, foreign_key: :user_id + belongs_to :user belongs_to :domain_block, foreign_key: :target_id belongs_to :domain_allow, foreign_key: :target_id belongs_to :email_domain_block, foreign_key: :target_id -- cgit From 21bf32635687770bc0026d769a69f49b89f8a0a2 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Sun, 19 Feb 2023 20:28:40 -0500 Subject: Autofix Rubocop Rails/Pluck (#23730) --- .rubocop_todo.yml | 11 ----------- app/lib/importer/base_importer.rb | 2 +- app/lib/link_details_extractor.rb | 8 ++++---- app/workers/scheduler/accounts_statuses_cleanup_scheduler.rb | 2 +- spec/controllers/api/v1/notifications_controller_spec.rb | 12 ++++++------ spec/controllers/api/v1/suggestions_controller_spec.rb | 2 +- .../webauthn_credentials_controller_spec.rb | 2 +- 7 files changed, 14 insertions(+), 25 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 1a524e6fd..954e42f9e 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -2435,17 +2435,6 @@ Rails/Output: Exclude: - 'lib/mastodon/ip_blocks_cli.rb' -# Offense count: 14 -# This cop supports safe autocorrection (--autocorrect). -Rails/Pluck: - Exclude: - - 'app/lib/importer/base_importer.rb' - - 'app/lib/link_details_extractor.rb' - - 'app/workers/scheduler/accounts_statuses_cleanup_scheduler.rb' - - 'spec/controllers/api/v1/notifications_controller_spec.rb' - - 'spec/controllers/api/v1/suggestions_controller_spec.rb' - - 'spec/controllers/settings/two_factor_authentication/webauthn_credentials_controller_spec.rb' - # Offense count: 9 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: Include. diff --git a/app/lib/importer/base_importer.rb b/app/lib/importer/base_importer.rb index ea522c600..0cd1d3422 100644 --- a/app/lib/importer/base_importer.rb +++ b/app/lib/importer/base_importer.rb @@ -45,7 +45,7 @@ class Importer::BaseImporter # Remove documents from the index that no longer exist in the database def clean_up! index.scroll_batches do |documents| - ids = documents.map { |doc| doc['_id'] } + ids = documents.pluck('_id') existence_map = index.adapter.target.where(id: ids).pluck(:id).each_with_object({}) { |id, map| map[id.to_s] = true } tmp = ids.reject { |id| existence_map[id] } diff --git a/app/lib/link_details_extractor.rb b/app/lib/link_details_extractor.rb index 74a7d0f3b..f8a0be636 100644 --- a/app/lib/link_details_extractor.rb +++ b/app/lib/link_details_extractor.rb @@ -188,7 +188,7 @@ class LinkDetailsExtractor end def language - valid_locale_or_nil(structured_data&.language || opengraph_tag('og:locale') || document.xpath('//html').map { |element| element['lang'] }.first) + valid_locale_or_nil(structured_data&.language || opengraph_tag('og:locale') || document.xpath('//html').pick('lang')) end def icon @@ -220,15 +220,15 @@ class LinkDetailsExtractor end def link_tag(name) - document.xpath("//link[@rel=\"#{name}\"]").map { |link| link['href'] }.first + document.xpath("//link[@rel=\"#{name}\"]").pick('href') end def opengraph_tag(name) - document.xpath("//meta[@property=\"#{name}\" or @name=\"#{name}\"]").map { |meta| meta['content'] }.first + document.xpath("//meta[@property=\"#{name}\" or @name=\"#{name}\"]").pick('content') end def meta_tag(name) - document.xpath("//meta[@name=\"#{name}\"]").map { |meta| meta['content'] }.first + document.xpath("//meta[@name=\"#{name}\"]").pick('content') end def structured_data diff --git a/app/workers/scheduler/accounts_statuses_cleanup_scheduler.rb b/app/workers/scheduler/accounts_statuses_cleanup_scheduler.rb index bd92fe32c..cc5b6e137 100644 --- a/app/workers/scheduler/accounts_statuses_cleanup_scheduler.rb +++ b/app/workers/scheduler/accounts_statuses_cleanup_scheduler.rb @@ -67,7 +67,7 @@ class Scheduler::AccountsStatusesCleanupScheduler end def compute_budget - threads = Sidekiq::ProcessSet.new.select { |x| x['queues'].include?('push') }.map { |x| x['concurrency'] }.sum + threads = Sidekiq::ProcessSet.new.select { |x| x['queues'].include?('push') }.pluck('concurrency').sum [PER_THREAD_BUDGET * threads, MAX_BUDGET].min end diff --git a/spec/controllers/api/v1/notifications_controller_spec.rb b/spec/controllers/api/v1/notifications_controller_spec.rb index 46e177c0e..22ebfa3dd 100644 --- a/spec/controllers/api/v1/notifications_controller_spec.rb +++ b/spec/controllers/api/v1/notifications_controller_spec.rb @@ -70,19 +70,19 @@ RSpec.describe Api::V1::NotificationsController, type: :controller do end it 'includes reblog' do - expect(body_as_json.map { |x| x[:type] }).to include 'reblog' + expect(body_as_json.pluck(:type)).to include 'reblog' end it 'includes mention' do - expect(body_as_json.map { |x| x[:type] }).to include 'mention' + expect(body_as_json.pluck(:type)).to include 'mention' end it 'includes favourite' do - expect(body_as_json.map { |x| x[:type] }).to include 'favourite' + expect(body_as_json.pluck(:type)).to include 'favourite' end it 'includes follow' do - expect(body_as_json.map { |x| x[:type] }).to include 'follow' + expect(body_as_json.pluck(:type)).to include 'follow' end end @@ -125,7 +125,7 @@ RSpec.describe Api::V1::NotificationsController, type: :controller do it 'returns everything but excluded type' do expect(body_as_json.size).to_not eq 0 - expect(body_as_json.map { |x| x[:type] }.uniq).to_not include 'mention' + expect(body_as_json.pluck(:type).uniq).to_not include 'mention' end end @@ -139,7 +139,7 @@ RSpec.describe Api::V1::NotificationsController, type: :controller do end it 'returns only requested type' do - expect(body_as_json.map { |x| x[:type] }.uniq).to eq ['mention'] + expect(body_as_json.pluck(:type).uniq).to eq ['mention'] end end end diff --git a/spec/controllers/api/v1/suggestions_controller_spec.rb b/spec/controllers/api/v1/suggestions_controller_spec.rb index 7805b6b4f..35ba155e7 100644 --- a/spec/controllers/api/v1/suggestions_controller_spec.rb +++ b/spec/controllers/api/v1/suggestions_controller_spec.rb @@ -29,7 +29,7 @@ RSpec.describe Api::V1::SuggestionsController, type: :controller do json = body_as_json expect(json.size).to be >= 1 - expect(json.map { |i| i[:id] }).to include(*[bob, jeff].map { |i| i.id.to_s }) + expect(json.pluck(:id)).to include(*[bob, jeff].map { |i| i.id.to_s }) end end 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 c3156c4e9..f060c3a4b 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 @@ -140,7 +140,7 @@ describe Settings::TwoFactorAuthentication::WebauthnCredentialsController do it 'includes existing credentials in list of excluded credentials' do get :options - excluded_credentials_ids = JSON.parse(response.body)['excludeCredentials'].map { |credential| credential['id'] } + excluded_credentials_ids = JSON.parse(response.body)['excludeCredentials'].pluck('id') expect(excluded_credentials_ids).to match_array(user.webauthn_credentials.pluck(:external_id)) end end -- cgit From a2fdb388eb412f3f90ec48bc990c7c2c24b8c072 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Sun, 19 Feb 2023 20:32:10 -0500 Subject: Autofix Rubocop RSpec/ReturnFromStub (#23724) --- .rubocop_todo.yml | 13 ------------- .../api/v1/accounts/credentials_controller_spec.rb | 2 +- spec/controllers/api/v1/apps/credentials_controller_spec.rb | 2 +- .../v1/statuses/favourited_by_accounts_controller_spec.rb | 2 +- .../v1/statuses/reblogged_by_accounts_controller_spec.rb | 2 +- spec/controllers/api/v1/statuses_controller_spec.rb | 2 +- spec/validators/blacklisted_email_validator_spec.rb | 2 +- 7 files changed, 6 insertions(+), 19 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 954e42f9e..73ebdbfd8 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1923,19 +1923,6 @@ RSpec/RepeatedExampleGroupDescription: - 'spec/controllers/admin/reports/actions_controller_spec.rb' - 'spec/policies/report_note_policy_spec.rb' -# Offense count: 6 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: and_return, block -RSpec/ReturnFromStub: - Exclude: - - 'spec/controllers/api/v1/accounts/credentials_controller_spec.rb' - - 'spec/controllers/api/v1/apps/credentials_controller_spec.rb' - - 'spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb' - - 'spec/controllers/api/v1/statuses/reblogged_by_accounts_controller_spec.rb' - - 'spec/controllers/api/v1/statuses_controller_spec.rb' - - 'spec/validators/blacklisted_email_validator_spec.rb' - # Offense count: 18 # This cop supports safe autocorrection (--autocorrect). RSpec/ScatteredLet: diff --git a/spec/controllers/api/v1/accounts/credentials_controller_spec.rb b/spec/controllers/api/v1/accounts/credentials_controller_spec.rb index d8aa00a07..a56b9d8fa 100644 --- a/spec/controllers/api/v1/accounts/credentials_controller_spec.rb +++ b/spec/controllers/api/v1/accounts/credentials_controller_spec.rb @@ -86,7 +86,7 @@ describe Api::V1::Accounts::CredentialsController do context 'without an oauth token' do before do - allow(controller).to receive(:doorkeeper_token) { nil } + allow(controller).to receive(:doorkeeper_token).and_return(nil) end describe 'GET #show' do diff --git a/spec/controllers/api/v1/apps/credentials_controller_spec.rb b/spec/controllers/api/v1/apps/credentials_controller_spec.rb index 0f811d5f3..470093c3c 100644 --- a/spec/controllers/api/v1/apps/credentials_controller_spec.rb +++ b/spec/controllers/api/v1/apps/credentials_controller_spec.rb @@ -30,7 +30,7 @@ describe Api::V1::Apps::CredentialsController do context 'without an oauth token' do before do - allow(controller).to receive(:doorkeeper_token) { nil } + allow(controller).to receive(:doorkeeper_token).and_return(nil) end describe 'GET #show' do diff --git a/spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb b/spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb index 4dcaba6bd..c1c6f5f12 100644 --- a/spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb +++ b/spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb @@ -45,7 +45,7 @@ RSpec.describe Api::V1::Statuses::FavouritedByAccountsController, type: :control context 'without an oauth token' do before do - allow(controller).to receive(:doorkeeper_token) { nil } + allow(controller).to receive(:doorkeeper_token).and_return(nil) end context 'with a private status' do diff --git a/spec/controllers/api/v1/statuses/reblogged_by_accounts_controller_spec.rb b/spec/controllers/api/v1/statuses/reblogged_by_accounts_controller_spec.rb index dc36d4ca0..90187a585 100644 --- a/spec/controllers/api/v1/statuses/reblogged_by_accounts_controller_spec.rb +++ b/spec/controllers/api/v1/statuses/reblogged_by_accounts_controller_spec.rb @@ -45,7 +45,7 @@ RSpec.describe Api::V1::Statuses::RebloggedByAccountsController, type: :controll context 'without an oauth token' do before do - allow(controller).to receive(:doorkeeper_token) { nil } + allow(controller).to receive(:doorkeeper_token).and_return(nil) end context 'with a private status' do diff --git a/spec/controllers/api/v1/statuses_controller_spec.rb b/spec/controllers/api/v1/statuses_controller_spec.rb index e4e6e172a..e839c8494 100644 --- a/spec/controllers/api/v1/statuses_controller_spec.rb +++ b/spec/controllers/api/v1/statuses_controller_spec.rb @@ -219,7 +219,7 @@ RSpec.describe Api::V1::StatusesController, type: :controller do context 'without an oauth token' do before do - allow(controller).to receive(:doorkeeper_token) { nil } + allow(controller).to receive(:doorkeeper_token).and_return(nil) end context 'with a private status' do diff --git a/spec/validators/blacklisted_email_validator_spec.rb b/spec/validators/blacklisted_email_validator_spec.rb index 351de0707..f9ee3b932 100644 --- a/spec/validators/blacklisted_email_validator_spec.rb +++ b/spec/validators/blacklisted_email_validator_spec.rb @@ -8,7 +8,7 @@ RSpec.describe BlacklistedEmailValidator, type: :validator do let(:errors) { double(add: nil) } before do - allow(user).to receive(:valid_invitation?) { false } + allow(user).to receive(:valid_invitation?).and_return(false) allow_any_instance_of(described_class).to receive(:blocked_email_provider?) { blocked_email } end -- cgit From 65ba0d92ef78f82a3cf5bf04f13b3d7393da015d Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Sun, 19 Feb 2023 20:33:27 -0500 Subject: Enable Rubocop RSpec/NotToNot (#23723) --- .rubocop.yml | 3 + .rubocop_todo.yml | 123 --------------------- .../activitypub/collections_controller_spec.rb | 4 +- .../activitypub/inboxes_controller_spec.rb | 6 +- .../account_moderation_notes_controller_spec.rb | 2 +- spec/controllers/admin/accounts_controller_spec.rb | 12 +- .../admin/change_email_controller_spec.rb | 2 +- .../admin/confirmations_controller_spec.rb | 2 +- .../admin/domain_blocks_controller_spec.rb | 2 +- .../admin/report_notes_controller_spec.rb | 4 +- .../settings/profiles_controller_spec.rb | 2 +- .../well_known/nodeinfo_controller_spec.rb | 2 +- spec/lib/activitypub/activity/announce_spec.rb | 2 +- spec/lib/request_spec.rb | 2 +- spec/lib/status_filter_spec.rb | 4 +- spec/lib/text_formatter_spec.rb | 2 +- spec/models/account_spec.rb | 10 +- spec/models/concerns/account_interactions_spec.rb | 6 +- spec/models/concerns/remotable_spec.rb | 4 +- spec/models/public_feed_spec.rb | 28 ++--- spec/models/setting_spec.rb | 4 +- spec/models/tag_spec.rb | 6 +- spec/models/user_spec.rb | 4 +- spec/services/account_search_service_spec.rb | 2 +- .../activitypub/process_collection_service_spec.rb | 10 +- .../process_status_update_service_spec.rb | 4 +- spec/services/block_domain_service_spec.rb | 6 +- spec/services/clear_domain_media_service_spec.rb | 6 +- spec/services/import_service_spec.rb | 2 +- spec/services/post_status_service_spec.rb | 4 +- spec/services/search_service_spec.rb | 6 +- .../validators/blacklisted_email_validator_spec.rb | 2 +- .../disallowed_hashtags_validator_spec.rb | 4 +- spec/validators/email_mx_validator_spec.rb | 2 +- spec/validators/follow_limit_validator_spec.rb | 4 +- spec/validators/poll_validator_spec.rb | 4 +- spec/validators/status_length_validator_spec.rb | 4 +- .../unreserved_username_validator_spec.rb | 4 +- spec/validators/url_validator_spec.rb | 2 +- spec/workers/feed_insert_worker_spec.rb | 6 +- 40 files changed, 94 insertions(+), 214 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 3783ccf48..fc1969a64 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -94,6 +94,9 @@ Rails/Exit: - 'lib/mastodon/cli_helper.rb' - 'lib/cli.rb' +RSpec/NotToNot: + EnforcedStyle: to_not + Style/HashSyntax: EnforcedStyle: ruby19_no_mixed_keys diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 73ebdbfd8..9076891e2 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1440,129 +1440,6 @@ RSpec/NoExpectationExample: - 'spec/controllers/auth/registrations_controller_spec.rb' - 'spec/services/precompute_feed_service_spec.rb' -# Offense count: 370 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: not_to, to_not -RSpec/NotToNot: - Exclude: - - 'spec/config/initializers/rack_attack_spec.rb' - - 'spec/controllers/accounts_controller_spec.rb' - - 'spec/controllers/admin/accounts_controller_spec.rb' - - 'spec/controllers/admin/email_domain_blocks_controller_spec.rb' - - 'spec/controllers/admin/roles_controller_spec.rb' - - 'spec/controllers/api/v1/accounts_controller_spec.rb' - - 'spec/controllers/api/v1/admin/account_actions_controller_spec.rb' - - 'spec/controllers/api/v1/admin/accounts_controller_spec.rb' - - 'spec/controllers/api/v1/admin/domain_allows_controller_spec.rb' - - 'spec/controllers/api/v1/admin/domain_blocks_controller_spec.rb' - - 'spec/controllers/api/v1/announcements/reactions_controller_spec.rb' - - 'spec/controllers/api/v1/announcements_controller_spec.rb' - - 'spec/controllers/api/v1/apps/credentials_controller_spec.rb' - - 'spec/controllers/api/v1/apps_controller_spec.rb' - - 'spec/controllers/api/v1/filters_controller_spec.rb' - - 'spec/controllers/api/v1/media_controller_spec.rb' - - 'spec/controllers/api/v1/notifications_controller_spec.rb' - - 'spec/controllers/api/v1/polls/votes_controller_spec.rb' - - 'spec/controllers/api/v1/reports_controller_spec.rb' - - 'spec/controllers/api/v1/statuses/mutes_controller_spec.rb' - - 'spec/controllers/api/v2/filters/keywords_controller_spec.rb' - - 'spec/controllers/api/v2/filters/statuses_controller_spec.rb' - - 'spec/controllers/api/v2/filters_controller_spec.rb' - - 'spec/controllers/auth/challenges_controller_spec.rb' - - 'spec/controllers/auth/confirmations_controller_spec.rb' - - 'spec/controllers/auth/passwords_controller_spec.rb' - - 'spec/controllers/auth/registrations_controller_spec.rb' - - 'spec/controllers/concerns/challengable_concern_spec.rb' - - 'spec/controllers/oauth/authorized_applications_controller_spec.rb' - - 'spec/controllers/oauth/tokens_controller_spec.rb' - - 'spec/controllers/settings/applications_controller_spec.rb' - - 'spec/controllers/settings/two_factor_authentication/webauthn_credentials_controller_spec.rb' - - 'spec/controllers/statuses_controller_spec.rb' - - 'spec/helpers/application_helper_spec.rb' - - 'spec/lib/activitypub/activity/announce_spec.rb' - - 'spec/lib/activitypub/activity/create_spec.rb' - - 'spec/lib/activitypub/activity/delete_spec.rb' - - 'spec/lib/activitypub/activity/flag_spec.rb' - - 'spec/lib/activitypub/dereferencer_spec.rb' - - 'spec/lib/activitypub/tag_manager_spec.rb' - - 'spec/lib/delivery_failure_tracker_spec.rb' - - 'spec/lib/feed_manager_spec.rb' - - 'spec/lib/html_aware_formatter_spec.rb' - - 'spec/lib/request_pool_spec.rb' - - 'spec/lib/status_reach_finder_spec.rb' - - 'spec/lib/vacuum/access_tokens_vacuum_spec.rb' - - 'spec/lib/vacuum/backups_vacuum_spec.rb' - - 'spec/lib/vacuum/media_attachments_vacuum_spec.rb' - - 'spec/lib/vacuum/preview_cards_vacuum_spec.rb' - - 'spec/lib/vacuum/statuses_vacuum_spec.rb' - - 'spec/lib/vacuum/system_keys_vacuum_spec.rb' - - 'spec/models/account/field_spec.rb' - - 'spec/models/account_conversation_spec.rb' - - 'spec/models/account_spec.rb' - - 'spec/models/account_statuses_cleanup_policy_spec.rb' - - 'spec/models/account_statuses_filter_spec.rb' - - 'spec/models/concerns/remotable_spec.rb' - - 'spec/models/concerns/status_threading_concern_spec.rb' - - 'spec/models/follow_spec.rb' - - 'spec/models/media_attachment_spec.rb' - - 'spec/models/status_spec.rb' - - 'spec/models/tag_feed_spec.rb' - - 'spec/models/trends/statuses_spec.rb' - - 'spec/models/trends/tags_spec.rb' - - 'spec/models/user_spec.rb' - - 'spec/models/webhook_spec.rb' - - 'spec/policies/account_moderation_note_policy_spec.rb' - - 'spec/policies/account_policy_spec.rb' - - 'spec/policies/backup_policy_spec.rb' - - 'spec/policies/custom_emoji_policy_spec.rb' - - 'spec/policies/domain_block_policy_spec.rb' - - 'spec/policies/email_domain_block_policy_spec.rb' - - 'spec/policies/instance_policy_spec.rb' - - 'spec/policies/invite_policy_spec.rb' - - 'spec/policies/relay_policy_spec.rb' - - 'spec/policies/report_note_policy_spec.rb' - - 'spec/policies/report_policy_spec.rb' - - 'spec/policies/settings_policy_spec.rb' - - 'spec/policies/status_policy_spec.rb' - - 'spec/policies/tag_policy_spec.rb' - - 'spec/policies/user_policy_spec.rb' - - 'spec/presenters/familiar_followers_presenter_spec.rb' - - 'spec/serializers/activitypub/note_spec.rb' - - 'spec/services/account_statuses_cleanup_service_spec.rb' - - 'spec/services/activitypub/fetch_remote_status_service_spec.rb' - - 'spec/services/activitypub/process_account_service_spec.rb' - - 'spec/services/activitypub/process_status_update_service_spec.rb' - - 'spec/services/app_sign_up_service_spec.rb' - - 'spec/services/batched_remove_status_service_spec.rb' - - 'spec/services/block_domain_service_spec.rb' - - 'spec/services/bootstrap_timeline_service_spec.rb' - - 'spec/services/fan_out_on_write_service_spec.rb' - - 'spec/services/favourite_service_spec.rb' - - 'spec/services/fetch_link_card_service_spec.rb' - - 'spec/services/fetch_oembed_service_spec.rb' - - 'spec/services/fetch_remote_status_service_spec.rb' - - 'spec/services/follow_service_spec.rb' - - 'spec/services/mute_service_spec.rb' - - 'spec/services/notify_service_spec.rb' - - 'spec/services/remove_status_service_spec.rb' - - 'spec/services/report_service_spec.rb' - - 'spec/services/resolve_account_service_spec.rb' - - 'spec/services/search_service_spec.rb' - - 'spec/services/suspend_account_service_spec.rb' - - 'spec/services/unallow_domain_service_spec.rb' - - 'spec/services/unsuspend_account_service_spec.rb' - - 'spec/services/update_status_service_spec.rb' - - 'spec/support/examples/models/concerns/account_avatar.rb' - - 'spec/support/examples/models/concerns/account_header.rb' - - 'spec/validators/email_mx_validator_spec.rb' - - 'spec/validators/note_length_validator_spec.rb' - - 'spec/validators/reaction_validator_spec.rb' - - 'spec/validators/status_length_validator_spec.rb' - - 'spec/validators/unique_username_validator_spec.rb' - - 'spec/workers/activitypub/fetch_replies_worker_spec.rb' - - 'spec/workers/scheduler/accounts_statuses_cleanup_scheduler_spec.rb' - # Offense count: 3 RSpec/PendingWithoutReason: Exclude: diff --git a/spec/controllers/activitypub/collections_controller_spec.rb b/spec/controllers/activitypub/collections_controller_spec.rb index 4e35938db..bf81cdb93 100644 --- a/spec/controllers/activitypub/collections_controller_spec.rb +++ b/spec/controllers/activitypub/collections_controller_spec.rb @@ -60,7 +60,7 @@ RSpec.describe ActivityPub::CollectionsController, type: :controller do end it 'does not include contents of private pinned status' do - expect(response.body).not_to include(private_pinned.text) + expect(response.body).to_not include(private_pinned.text) end context 'when account is permanently suspended' do @@ -115,7 +115,7 @@ RSpec.describe ActivityPub::CollectionsController, type: :controller do end it 'does not include contents of private pinned status' do - expect(response.body).not_to include(private_pinned.text) + expect(response.body).to_not include(private_pinned.text) end end diff --git a/spec/controllers/activitypub/inboxes_controller_spec.rb b/spec/controllers/activitypub/inboxes_controller_spec.rb index 2f023197b..7f4d6b2d3 100644 --- a/spec/controllers/activitypub/inboxes_controller_spec.rb +++ b/spec/controllers/activitypub/inboxes_controller_spec.rb @@ -68,7 +68,7 @@ RSpec.describe ActivityPub::InboxesController, type: :controller do let(:synchronization_collection) { 'https://example.com/followers2' } it 'does not start a synchronization job' do - expect(ActivityPub::FollowersSynchronizationWorker).not_to have_received(:perform_async) + expect(ActivityPub::FollowersSynchronizationWorker).to_not have_received(:perform_async) end end @@ -76,13 +76,13 @@ RSpec.describe ActivityPub::InboxesController, type: :controller do let(:synchronization_url) { 'https://example.org/followers' } it 'does not start a synchronization job' do - expect(ActivityPub::FollowersSynchronizationWorker).not_to have_received(:perform_async) + expect(ActivityPub::FollowersSynchronizationWorker).to_not have_received(:perform_async) end end context 'with matching digest' do it 'does not start a synchronization job' do - expect(ActivityPub::FollowersSynchronizationWorker).not_to have_received(:perform_async) + expect(ActivityPub::FollowersSynchronizationWorker).to_not have_received(:perform_async) end end diff --git a/spec/controllers/admin/account_moderation_notes_controller_spec.rb b/spec/controllers/admin/account_moderation_notes_controller_spec.rb index d3f3263f8..b8d606322 100644 --- a/spec/controllers/admin/account_moderation_notes_controller_spec.rb +++ b/spec/controllers/admin/account_moderation_notes_controller_spec.rb @@ -26,7 +26,7 @@ RSpec.describe Admin::AccountModerationNotesController, type: :controller do let(:params) { { account_moderation_note: { target_account_id: target_account.id, content: '' } } } it 'falls to create a note' do - expect { subject }.not_to change { AccountModerationNote.count } + expect { subject }.to_not change { AccountModerationNote.count } expect(subject).to render_template 'admin/accounts/show' end end diff --git a/spec/controllers/admin/accounts_controller_spec.rb b/spec/controllers/admin/accounts_controller_spec.rb index 48204b7b6..35d79740a 100644 --- a/spec/controllers/admin/accounts_controller_spec.rb +++ b/spec/controllers/admin/accounts_controller_spec.rb @@ -84,7 +84,7 @@ RSpec.describe Admin::AccountsController, type: :controller do it 'fails to memorialize account' do is_expected.to have_http_status :forbidden - expect(account.reload).not_to be_memorial + expect(account.reload).to_not be_memorial end end @@ -106,7 +106,7 @@ RSpec.describe Admin::AccountsController, type: :controller do it 'fails to memorialize account' do is_expected.to have_http_status :forbidden - expect(account.reload).not_to be_memorial + expect(account.reload).to_not be_memorial end end @@ -115,7 +115,7 @@ RSpec.describe Admin::AccountsController, type: :controller do it 'fails to memorialize account' do is_expected.to have_http_status :forbidden - expect(account.reload).not_to be_memorial + expect(account.reload).to_not be_memorial end end end @@ -133,7 +133,7 @@ RSpec.describe Admin::AccountsController, type: :controller do it 'succeeds in enabling account' do is_expected.to redirect_to admin_account_path(account.id) - expect(user.reload).not_to be_disabled + expect(user.reload).to_not be_disabled end end @@ -183,7 +183,7 @@ RSpec.describe Admin::AccountsController, type: :controller do it 'fails to approve account' do is_expected.to have_http_status :forbidden - expect(user.reload).not_to be_approved + expect(user.reload).to_not be_approved end end end @@ -223,7 +223,7 @@ RSpec.describe Admin::AccountsController, type: :controller do it 'fails to reject account' do is_expected.to have_http_status :forbidden - expect(user.reload).not_to be_approved + expect(user.reload).to_not be_approved end end end diff --git a/spec/controllers/admin/change_email_controller_spec.rb b/spec/controllers/admin/change_email_controller_spec.rb index 0814f327d..520842a19 100644 --- a/spec/controllers/admin/change_email_controller_spec.rb +++ b/spec/controllers/admin/change_email_controller_spec.rb @@ -35,7 +35,7 @@ RSpec.describe Admin::ChangeEmailsController, type: :controller do expect(user.email).to eq previous_email expect(user.unconfirmed_email).to eq 'test@example.com' - expect(user.confirmation_token).not_to be_nil + expect(user.confirmation_token).to_not be_nil expect(UserMailer).to have_received(:confirmation_instructions).with(user, user.confirmation_token, { to: 'test@example.com' }) diff --git a/spec/controllers/admin/confirmations_controller_spec.rb b/spec/controllers/admin/confirmations_controller_spec.rb index 6268903c4..7ca90f3e1 100644 --- a/spec/controllers/admin/confirmations_controller_spec.rb +++ b/spec/controllers/admin/confirmations_controller_spec.rb @@ -55,7 +55,7 @@ RSpec.describe Admin::ConfirmationsController, type: :controller do it 'does not resend confirmation mail' do expect(subject).to redirect_to admin_accounts_path expect(flash[:error]).to eq I18n.t('admin.accounts.resend_confirmation.already_confirmed') - expect(UserMailer).not_to have_received(:confirmation_instructions) + expect(UserMailer).to_not have_received(:confirmation_instructions) end end end diff --git a/spec/controllers/admin/domain_blocks_controller_spec.rb b/spec/controllers/admin/domain_blocks_controller_spec.rb index 3b2fd6c5d..92fc19efa 100644 --- a/spec/controllers/admin/domain_blocks_controller_spec.rb +++ b/spec/controllers/admin/domain_blocks_controller_spec.rb @@ -54,7 +54,7 @@ RSpec.describe Admin::DomainBlocksController, type: :controller do post :create, params: { domain_block: { domain: 'example.com', severity: 'silence' } } - expect(DomainBlockWorker).not_to have_received(:perform_async) + expect(DomainBlockWorker).to_not have_received(:perform_async) expect(response).to render_template :new end diff --git a/spec/controllers/admin/report_notes_controller_spec.rb b/spec/controllers/admin/report_notes_controller_spec.rb index fa7572d18..8a2603611 100644 --- a/spec/controllers/admin/report_notes_controller_spec.rb +++ b/spec/controllers/admin/report_notes_controller_spec.rb @@ -34,7 +34,7 @@ describe Admin::ReportNotesController do it 'creates a report note and does not resolve report' do expect { subject }.to change { ReportNote.count }.by(1) - expect(report.reload).not_to be_action_taken + expect(report.reload).to_not be_action_taken expect(subject).to redirect_to admin_report_path(report) end end @@ -49,7 +49,7 @@ describe Admin::ReportNotesController do it 'creates a report note and unresolves report' do expect { subject }.to change { ReportNote.count }.by(1) - expect(report.reload).not_to be_action_taken + expect(report.reload).to_not be_action_taken expect(subject).to redirect_to admin_report_path(report) end end diff --git a/spec/controllers/settings/profiles_controller_spec.rb b/spec/controllers/settings/profiles_controller_spec.rb index fbbca8bb9..c7a6ad664 100644 --- a/spec/controllers/settings/profiles_controller_spec.rb +++ b/spec/controllers/settings/profiles_controller_spec.rb @@ -38,7 +38,7 @@ RSpec.describe Settings::ProfilesController, type: :controller do put :update, params: { account: { avatar: fixture_file_upload('avatar.gif', 'image/gif') } } expect(response).to redirect_to(settings_profile_path) - expect(account.reload.avatar.instance.avatar_file_name).not_to be_nil + expect(account.reload.avatar.instance.avatar_file_name).to_not be_nil expect(ActivityPub::UpdateDistributionWorker).to have_received(:perform_async).with(account.id) end end diff --git a/spec/controllers/well_known/nodeinfo_controller_spec.rb b/spec/controllers/well_known/nodeinfo_controller_spec.rb index 964a14706..e9436cd26 100644 --- a/spec/controllers/well_known/nodeinfo_controller_spec.rb +++ b/spec/controllers/well_known/nodeinfo_controller_spec.rb @@ -27,7 +27,7 @@ describe WellKnown::NodeInfoController, type: :controller do json = body_as_json - expect({ 'foo' => 0 }).not_to match_json_schema('nodeinfo_2.0') + expect({ 'foo' => 0 }).to_not match_json_schema('nodeinfo_2.0') expect(json).to match_json_schema('nodeinfo_2.0') expect(json[:version]).to eq '2.0' expect(json[:usage]).to be_a Hash diff --git a/spec/lib/activitypub/activity/announce_spec.rb b/spec/lib/activitypub/activity/announce_spec.rb index 461c3757b..adb13acc2 100644 --- a/spec/lib/activitypub/activity/announce_spec.rb +++ b/spec/lib/activitypub/activity/announce_spec.rb @@ -139,7 +139,7 @@ RSpec.describe ActivityPub::Activity::Announce do end it 'does not fetch the remote status' do - expect(a_request(:get, 'https://example.com/actor/hello-world')).not_to have_been_made + expect(a_request(:get, 'https://example.com/actor/hello-world')).to_not have_been_made expect(Status.find_by(uri: 'https://example.com/actor/hello-world')).to be_nil end diff --git a/spec/lib/request_spec.rb b/spec/lib/request_spec.rb index e555a8b5a..f63a836de 100644 --- a/spec/lib/request_spec.rb +++ b/spec/lib/request_spec.rb @@ -102,7 +102,7 @@ describe Request do it 'accepts body less than 1 megabyte by default' do stub_request(:any, 'http://example.com').to_return(body: SecureRandom.random_bytes(2.kilobytes)) - expect { subject.perform { |response| response.body_with_limit } }.not_to raise_error + expect { subject.perform { |response| response.body_with_limit } }.to_not raise_error end it 'rejects body by given size' do diff --git a/spec/lib/status_filter_spec.rb b/spec/lib/status_filter_spec.rb index 287fe00de..cdb482059 100644 --- a/spec/lib/status_filter_spec.rb +++ b/spec/lib/status_filter_spec.rb @@ -10,7 +10,7 @@ describe StatusFilter do subject { described_class.new(status, nil) } context 'when there are no connections' do - it { is_expected.not_to be_filtered } + it { is_expected.to_not be_filtered } end context 'when status account is silenced' do @@ -36,7 +36,7 @@ describe StatusFilter do subject { described_class.new(status, account) } context 'when there are no connections' do - it { is_expected.not_to be_filtered } + it { is_expected.to_not be_filtered } end context 'when status account is blocked' do diff --git a/spec/lib/text_formatter_spec.rb b/spec/lib/text_formatter_spec.rb index d4a3a6b59..cc742b65e 100644 --- a/spec/lib/text_formatter_spec.rb +++ b/spec/lib/text_formatter_spec.rb @@ -18,7 +18,7 @@ RSpec.describe TextFormatter do let(:text) { "line\nfeed" } it 'removes line feeds' do - is_expected.not_to include "\n" + is_expected.to_not include "\n" end end diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index 763835618..03ed12d78 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -31,7 +31,7 @@ RSpec.describe Account, type: :model do end it 'does not raise an error' do - expect { subject.suspend! }.not_to raise_error + expect { subject.suspend! }.to_not raise_error end end end @@ -206,7 +206,7 @@ RSpec.describe Account, type: :model do end it 'calls not ResolveAccountService#call' do - expect_any_instance_of(ResolveAccountService).not_to receive(:call).with(acct) + expect_any_instance_of(ResolveAccountService).to_not receive(:call).with(acct) account.refresh! end end @@ -811,19 +811,19 @@ RSpec.describe Account, type: :model do it 'is valid even if the username is longer than 30 characters' do account = Fabricate.build(:account, domain: 'domain', username: Faker::Lorem.characters(number: 31)) account.valid? - expect(account).not_to model_have_error_on_field(:username) + expect(account).to_not model_have_error_on_field(:username) end it 'is valid even if the display name is longer than 30 characters' do account = Fabricate.build(:account, domain: 'domain', display_name: Faker::Lorem.characters(number: 31)) account.valid? - expect(account).not_to model_have_error_on_field(:display_name) + expect(account).to_not model_have_error_on_field(:display_name) end it 'is valid even if the note is longer than 500 characters' do account = Fabricate.build(:account, domain: 'domain', note: Faker::Lorem.characters(number: 501)) account.valid? - expect(account).not_to model_have_error_on_field(:note) + expect(account).to_not model_have_error_on_field(:note) end end end diff --git a/spec/models/concerns/account_interactions_spec.rb b/spec/models/concerns/account_interactions_spec.rb index b79c44594..b2d84308b 100644 --- a/spec/models/concerns/account_interactions_spec.rb +++ b/spec/models/concerns/account_interactions_spec.rb @@ -163,7 +163,7 @@ describe AccountInteractions do it 'returns Mute without updating mute.hide_notifications' do expect do expect(subject).to be_a Mute - end.not_to change { mute.reload.hide_notifications? }.from(true) + end.to_not change { mute.reload.hide_notifications? }.from(true) end end @@ -183,7 +183,7 @@ describe AccountInteractions do it 'returns Mute without updating mute.hide_notifications' do expect do expect(subject).to be_a Mute - end.not_to change { mute.reload.hide_notifications? }.from(true) + end.to_not change { mute.reload.hide_notifications? }.from(true) end end end @@ -207,7 +207,7 @@ describe AccountInteractions do it 'returns Mute without updating mute.hide_notifications' do expect do expect(subject).to be_a Mute - end.not_to change { mute.reload.hide_notifications? }.from(false) + end.to_not change { mute.reload.hide_notifications? }.from(false) end end diff --git a/spec/models/concerns/remotable_spec.rb b/spec/models/concerns/remotable_spec.rb index ca2d65d2d..964520427 100644 --- a/spec/models/concerns/remotable_spec.rb +++ b/spec/models/concerns/remotable_spec.rb @@ -147,8 +147,8 @@ RSpec.describe Remotable do let(:code) { 500 } it 'does not assign file' do - expect(foo).not_to receive(:public_send).with("#{hoge}=", any_args) - expect(foo).not_to receive(:public_send).with("#{hoge}_file_name=", any_args) + expect(foo).to_not receive(:public_send).with("#{hoge}=", any_args) + expect(foo).to_not receive(:public_send).with("#{hoge}_file_name=", any_args) foo.hoge_remote_url = url end diff --git a/spec/models/public_feed_spec.rb b/spec/models/public_feed_spec.rb index 0ffc343f1..be46639c5 100644 --- a/spec/models/public_feed_spec.rb +++ b/spec/models/public_feed_spec.rb @@ -11,7 +11,7 @@ RSpec.describe PublicFeed, type: :model do private_status = Fabricate(:status, visibility: :private) expect(subject).to include(public_status.id) - expect(subject).not_to include(private_status.id) + expect(subject).to_not include(private_status.id) end it 'does not include replies' do @@ -19,7 +19,7 @@ RSpec.describe PublicFeed, type: :model do reply = Fabricate(:status, in_reply_to_id: status.id) expect(subject).to include(status.id) - expect(subject).not_to include(reply.id) + expect(subject).to_not include(reply.id) end it 'does not include boosts' do @@ -27,7 +27,7 @@ RSpec.describe PublicFeed, type: :model do boost = Fabricate(:status, reblog_of_id: status.id) expect(subject).to include(status.id) - expect(subject).not_to include(boost.id) + expect(subject).to_not include(boost.id) end it 'filters out silenced accounts' do @@ -36,7 +36,7 @@ RSpec.describe PublicFeed, type: :model do silenced_status = Fabricate(:status, account: silenced_account) expect(subject).to include(status.id) - expect(subject).not_to include(silenced_status.id) + expect(subject).to_not include(silenced_status.id) end context 'without local_only option' do @@ -87,7 +87,7 @@ RSpec.describe PublicFeed, type: :model do it 'does not include remote instances statuses' do expect(subject).to include(local_status.id) - expect(subject).not_to include(remote_status.id) + expect(subject).to_not include(remote_status.id) end end @@ -96,13 +96,13 @@ RSpec.describe PublicFeed, type: :model do it 'does not include remote instances statuses' do expect(subject).to include(local_status.id) - expect(subject).not_to include(remote_status.id) + expect(subject).to_not include(remote_status.id) end it 'is not affected by personal domain blocks' do viewer.block_domain!('test.com') expect(subject).to include(local_status.id) - expect(subject).not_to include(remote_status.id) + expect(subject).to_not include(remote_status.id) end end end @@ -119,7 +119,7 @@ RSpec.describe PublicFeed, type: :model do let(:viewer) { nil } it 'does not include local instances statuses' do - expect(subject).not_to include(local_status.id) + expect(subject).to_not include(local_status.id) expect(subject).to include(remote_status.id) end end @@ -128,7 +128,7 @@ RSpec.describe PublicFeed, type: :model do let(:viewer) { Fabricate(:account, username: 'viewer') } it 'does not include local instances statuses' do - expect(subject).not_to include(local_status.id) + expect(subject).to_not include(local_status.id) expect(subject).to include(remote_status.id) end end @@ -146,7 +146,7 @@ RSpec.describe PublicFeed, type: :model do @account.block!(blocked) blocked_status = Fabricate(:status, account: blocked) - expect(subject).not_to include(blocked_status.id) + expect(subject).to_not include(blocked_status.id) end it 'excludes statuses from accounts who have blocked the account' do @@ -154,7 +154,7 @@ RSpec.describe PublicFeed, type: :model do blocker.block!(@account) blocked_status = Fabricate(:status, account: blocker) - expect(subject).not_to include(blocked_status.id) + expect(subject).to_not include(blocked_status.id) end it 'excludes statuses from accounts muted by the account' do @@ -162,7 +162,7 @@ RSpec.describe PublicFeed, type: :model do @account.mute!(muted) muted_status = Fabricate(:status, account: muted) - expect(subject).not_to include(muted_status.id) + expect(subject).to_not include(muted_status.id) end it 'excludes statuses from accounts from personally blocked domains' do @@ -170,7 +170,7 @@ RSpec.describe PublicFeed, type: :model do @account.block_domain!(blocked.domain) blocked_status = Fabricate(:status, account: blocked) - expect(subject).not_to include(blocked_status.id) + expect(subject).to_not include(blocked_status.id) end context 'with language preferences' do @@ -182,7 +182,7 @@ RSpec.describe PublicFeed, type: :model do expect(subject).to include(en_status.id) expect(subject).to include(es_status.id) - expect(subject).not_to include(fr_status.id) + expect(subject).to_not include(fr_status.id) end it 'includes all languages when user does not have a setting' do diff --git a/spec/models/setting_spec.rb b/spec/models/setting_spec.rb index 83ba415a8..077223094 100644 --- a/spec/models/setting_spec.rb +++ b/spec/models/setting_spec.rb @@ -38,7 +38,7 @@ RSpec.describe Setting, type: :model do let(:cache_value) { 'cache-value' } it 'calls not RailsSettings::Base#[]' do - expect(RailsSettings::Base).not_to receive(:[]).with(key) + expect(RailsSettings::Base).to_not receive(:[]).with(key) described_class[key] end @@ -104,7 +104,7 @@ RSpec.describe Setting, type: :model do ActiveSupport::Notifications.subscribed callback, 'sql.active_record' do described_class[key] end - expect(callback).not_to have_received(:call) + expect(callback).to_not have_received(:call) end it 'returns the cached value' do diff --git a/spec/models/tag_spec.rb b/spec/models/tag_spec.rb index 102d2f625..7043449c5 100644 --- a/spec/models/tag_spec.rb +++ b/spec/models/tag_spec.rb @@ -4,15 +4,15 @@ require 'rails_helper' RSpec.describe Tag do describe 'validations' do it 'invalid with #' do - expect(described_class.new(name: '#hello_world')).not_to be_valid + expect(described_class.new(name: '#hello_world')).to_not be_valid end it 'invalid with .' do - expect(described_class.new(name: '.abcdef123')).not_to be_valid + expect(described_class.new(name: '.abcdef123')).to_not be_valid end it 'invalid with spaces' do - expect(described_class.new(name: 'hello world')).not_to be_valid + expect(described_class.new(name: 'hello world')).to_not be_valid end it 'valid with aesthetic' do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index dde1503c0..c2f7e99ac 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -159,7 +159,7 @@ RSpec.describe User, type: :model do it 'does not trigger the account.approved Web Hook' do subject - expect(TriggerWebhookWorker).not_to have_received(:perform_async).with('account.approved', 'Account', user.account_id) + expect(TriggerWebhookWorker).to_not have_received(:perform_async).with('account.approved', 'Account', user.account_id) end end @@ -270,7 +270,7 @@ RSpec.describe User, type: :model do it 'does not trigger the account.approved Web Hook' do subject - expect(TriggerWebhookWorker).not_to have_received(:perform_async).with('account.approved', 'Account', user.account_id) + expect(TriggerWebhookWorker).to_not have_received(:perform_async).with('account.approved', 'Account', user.account_id) end end end diff --git a/spec/services/account_search_service_spec.rb b/spec/services/account_search_service_spec.rb index d3b5baad6..45e19d1ef 100644 --- a/spec/services/account_search_service_spec.rb +++ b/spec/services/account_search_service_spec.rb @@ -63,7 +63,7 @@ describe AccountSearchService, type: :service do allow(ResolveAccountService).to receive(:new).and_return(service) results = subject.call('newuser@remote.com', nil, limit: 10, resolve: false) - expect(service).not_to have_received(:call) + expect(service).to_not have_received(:call) end end diff --git a/spec/services/activitypub/process_collection_service_spec.rb b/spec/services/activitypub/process_collection_service_spec.rb index fbfa6d6c6..d35d9596d 100644 --- a/spec/services/activitypub/process_collection_service_spec.rb +++ b/spec/services/activitypub/process_collection_service_spec.rb @@ -39,7 +39,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do end it 'does not process payload' do - expect(ActivityPub::Activity).not_to receive(:factory) + expect(ActivityPub::Activity).to_not receive(:factory) subject.call(json, actor) end end @@ -69,7 +69,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do it 'does not process payload if no signature exists' do expect_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_actor!).and_return(nil) - expect(ActivityPub::Activity).not_to receive(:factory) + expect(ActivityPub::Activity).to_not receive(:factory) subject.call(json, forwarder) end @@ -87,7 +87,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do payload['signature'] = { 'type' => 'RsaSignature2017' } expect_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_actor!).and_return(nil) - expect(ActivityPub::Activity).not_to receive(:factory) + expect(ActivityPub::Activity).to_not receive(:factory) subject.call(json, forwarder) end @@ -206,7 +206,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do end it 'does not process forged payload' do - expect(ActivityPub::Activity).not_to receive(:factory).with( + expect(ActivityPub::Activity).to_not receive(:factory).with( hash_including( 'object' => hash_including( 'id' => 'https://example.com/users/bob/fake-status' @@ -216,7 +216,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do anything ) - expect(ActivityPub::Activity).not_to receive(:factory).with( + expect(ActivityPub::Activity).to_not receive(:factory).with( hash_including( 'object' => hash_including( 'content' => '

puck was here

' diff --git a/spec/services/activitypub/process_status_update_service_spec.rb b/spec/services/activitypub/process_status_update_service_spec.rb index 5d15f6ffe..ae7db88bf 100644 --- a/spec/services/activitypub/process_status_update_service_spec.rb +++ b/spec/services/activitypub/process_status_update_service_spec.rb @@ -214,11 +214,11 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do end it 'does not create any edits' do - expect { subject.call(status, json) }.not_to change { status.reload.edits.pluck(&:id) } + expect { subject.call(status, json) }.to_not change { status.reload.edits.pluck(&:id) } end it 'does not update the text, spoiler_text or edited_at' do - expect { subject.call(status, json) }.not_to change { s = status.reload; [s.text, s.spoiler_text, s.edited_at] } + expect { subject.call(status, json) }.to_not change { s = status.reload; [s.text, s.spoiler_text, s.edited_at] } end end diff --git a/spec/services/block_domain_service_spec.rb b/spec/services/block_domain_service_spec.rb index 242b02fff..e24e48d41 100644 --- a/spec/services/block_domain_service_spec.rb +++ b/spec/services/block_domain_service_spec.rb @@ -67,9 +67,9 @@ RSpec.describe BlockDomainService, type: :service do end it 'leaves the domains status and attachments, but clears media' do - expect { bad_status1.reload }.not_to raise_error - expect { bad_status2.reload }.not_to raise_error - expect { bad_attachment.reload }.not_to raise_error + expect { bad_status1.reload }.to_not raise_error + expect { bad_status2.reload }.to_not raise_error + expect { bad_attachment.reload }.to_not raise_error expect(bad_attachment.file.exists?).to be false end end diff --git a/spec/services/clear_domain_media_service_spec.rb b/spec/services/clear_domain_media_service_spec.rb index 45b92e2c9..e90faf84d 100644 --- a/spec/services/clear_domain_media_service_spec.rb +++ b/spec/services/clear_domain_media_service_spec.rb @@ -14,9 +14,9 @@ RSpec.describe ClearDomainMediaService, type: :service do end it 'leaves the domains status and attachments, but clears media' do - expect { bad_status1.reload }.not_to raise_error - expect { bad_status2.reload }.not_to raise_error - expect { bad_attachment.reload }.not_to raise_error + expect { bad_status1.reload }.to_not raise_error + expect { bad_status2.reload }.to_not raise_error + expect { bad_attachment.reload }.to_not raise_error expect(bad_attachment.file.exists?).to be false end end diff --git a/spec/services/import_service_spec.rb b/spec/services/import_service_spec.rb index a12148833..2b1516ff0 100644 --- a/spec/services/import_service_spec.rb +++ b/spec/services/import_service_spec.rb @@ -234,7 +234,7 @@ RSpec.describe ImportService, type: :service do subject.call(import) expect(account.bookmarks.map(&:status).map(&:id)).to include(local_status.id) expect(account.bookmarks.map(&:status).map(&:id)).to include(remote_status.id) - expect(account.bookmarks.map(&:status).map(&:id)).not_to include(direct_status.id) + expect(account.bookmarks.map(&:status).map(&:id)).to_not include(direct_status.id) expect(account.bookmarks.count).to eq 3 end end diff --git a/spec/services/post_status_service_spec.rb b/spec/services/post_status_service_spec.rb index 0b72253a5..2148f1819 100644 --- a/spec/services/post_status_service_spec.rb +++ b/spec/services/post_status_service_spec.rb @@ -50,7 +50,7 @@ RSpec.describe PostStatusService, type: :service do end it 'does not change statuses count' do - expect { subject.call(account, text: 'Hi future!', scheduled_at: future, thread: previous_status) }.not_to change { [account.statuses_count, previous_status.replies_count] } + expect { subject.call(account, text: 'Hi future!', scheduled_at: future, thread: previous_status) }.to_not change { [account.statuses_count, previous_status.replies_count] } end end @@ -157,7 +157,7 @@ RSpec.describe PostStatusService, type: :service do expect do subject.call(account, text: '@alice @alice @alice hey @alice') - end.not_to raise_error + end.to_not raise_error end it 'processes hashtags' do diff --git a/spec/services/search_service_spec.rb b/spec/services/search_service_spec.rb index 6f32007e8..7ec334a56 100644 --- a/spec/services/search_service_spec.rb +++ b/spec/services/search_service_spec.rb @@ -13,8 +13,8 @@ describe SearchService, type: :service do results = subject.call('', nil, 10) expect(results).to eq(empty_results) - expect(AccountSearchService).not_to have_received(:new) - expect(Tag).not_to have_received(:search_for) + expect(AccountSearchService).to_not have_received(:new) + expect(Tag).to_not have_received(:search_for) end end @@ -89,7 +89,7 @@ describe SearchService, type: :service do allow(Tag).to receive(:search_for) results = subject.call(query, nil, 10) - expect(Tag).not_to have_received(:search_for) + expect(Tag).to_not have_received(:search_for) expect(results).to eq empty_results end diff --git a/spec/validators/blacklisted_email_validator_spec.rb b/spec/validators/blacklisted_email_validator_spec.rb index f9ee3b932..cb807fe24 100644 --- a/spec/validators/blacklisted_email_validator_spec.rb +++ b/spec/validators/blacklisted_email_validator_spec.rb @@ -26,7 +26,7 @@ RSpec.describe BlacklistedEmailValidator, type: :validator do let(:blocked_email) { false } it 'does not add errors' do - expect(subject).not_to have_received(:add).with(:email, :blocked) + expect(subject).to_not have_received(:add).with(:email, :blocked) end context 'when canonical e-mail is blocked' do diff --git a/spec/validators/disallowed_hashtags_validator_spec.rb b/spec/validators/disallowed_hashtags_validator_spec.rb index 9deec0bb9..2c4ebc4f2 100644 --- a/spec/validators/disallowed_hashtags_validator_spec.rb +++ b/spec/validators/disallowed_hashtags_validator_spec.rb @@ -19,7 +19,7 @@ RSpec.describe DisallowedHashtagsValidator, type: :validator do let(:reblog) { true } it 'does not add errors' do - expect(errors).not_to have_received(:add).with(:text, any_args) + expect(errors).to_not have_received(:add).with(:text, any_args) end end @@ -31,7 +31,7 @@ RSpec.describe DisallowedHashtagsValidator, type: :validator do let(:disallowed_tags) { [] } it 'does not add errors' do - expect(errors).not_to have_received(:add).with(:text, any_args) + expect(errors).to_not have_received(:add).with(:text, any_args) end end diff --git a/spec/validators/email_mx_validator_spec.rb b/spec/validators/email_mx_validator_spec.rb index 6640d6058..ffb6851d0 100644 --- a/spec/validators/email_mx_validator_spec.rb +++ b/spec/validators/email_mx_validator_spec.rb @@ -38,7 +38,7 @@ describe EmailMxValidator do allow(Resolv::DNS).to receive(:open).and_yield(resolver) subject.validate(user) - expect(user.errors).not_to have_received(:add) + expect(user.errors).to_not have_received(:add) end it 'adds an error if the email domain name contains empty labels' do diff --git a/spec/validators/follow_limit_validator_spec.rb b/spec/validators/follow_limit_validator_spec.rb index cc8fbb631..94ba0c47f 100644 --- a/spec/validators/follow_limit_validator_spec.rb +++ b/spec/validators/follow_limit_validator_spec.rb @@ -22,7 +22,7 @@ RSpec.describe FollowLimitValidator, type: :validator do let(:_nil) { true } it 'not calls errors.add' do - expect(errors).not_to have_received(:add).with(:base, any_args) + expect(errors).to_not have_received(:add).with(:base, any_args) end end @@ -43,7 +43,7 @@ RSpec.describe FollowLimitValidator, type: :validator do let(:limit_reached) { false } it 'not calls errors.add' do - expect(errors).not_to have_received(:add).with(:base, any_args) + expect(errors).to_not have_received(:add).with(:base, any_args) end end end diff --git a/spec/validators/poll_validator_spec.rb b/spec/validators/poll_validator_spec.rb index a76c63ccc..f3f4b1288 100644 --- a/spec/validators/poll_validator_spec.rb +++ b/spec/validators/poll_validator_spec.rb @@ -15,14 +15,14 @@ RSpec.describe PollValidator, type: :validator do let(:expires_at) { 1.day.from_now } it 'have no errors' do - expect(errors).not_to have_received(:add) + expect(errors).to_not have_received(:add) end context 'expires just 5 min ago' do let(:expires_at) { 5.minutes.from_now } it 'not calls errors add' do - expect(errors).not_to have_received(:add) + expect(errors).to_not have_received(:add) end end end diff --git a/spec/validators/status_length_validator_spec.rb b/spec/validators/status_length_validator_spec.rb index db9c728a8..e132b5618 100644 --- a/spec/validators/status_length_validator_spec.rb +++ b/spec/validators/status_length_validator_spec.rb @@ -7,13 +7,13 @@ describe StatusLengthValidator do it 'does not add errors onto remote statuses' do status = double(local?: false) subject.validate(status) - expect(status).not_to receive(:errors) + expect(status).to_not receive(:errors) end it 'does not add errors onto local reblogs' do status = double(local?: false, reblog?: true) subject.validate(status) - expect(status).not_to receive(:errors) + expect(status).to_not receive(:errors) end it 'adds an error when content warning is over 500 characters' do diff --git a/spec/validators/unreserved_username_validator_spec.rb b/spec/validators/unreserved_username_validator_spec.rb index e2f051b08..3c6f71c59 100644 --- a/spec/validators/unreserved_username_validator_spec.rb +++ b/spec/validators/unreserved_username_validator_spec.rb @@ -17,7 +17,7 @@ RSpec.describe UnreservedUsernameValidator, type: :validator do let(:username) { nil } it 'not calls errors.add' do - expect(errors).not_to have_received(:add).with(:username, any_args) + expect(errors).to_not have_received(:add).with(:username, any_args) end end @@ -36,7 +36,7 @@ RSpec.describe UnreservedUsernameValidator, type: :validator do let(:reserved_username) { false } it 'not calls errors.add' do - expect(errors).not_to have_received(:add).with(:username, any_args) + expect(errors).to_not have_received(:add).with(:username, any_args) end end end diff --git a/spec/validators/url_validator_spec.rb b/spec/validators/url_validator_spec.rb index 85eadeb63..966261b50 100644 --- a/spec/validators/url_validator_spec.rb +++ b/spec/validators/url_validator_spec.rb @@ -27,7 +27,7 @@ RSpec.describe URLValidator, type: :validator do let(:compliant) { true } it 'not calls errors.add' do - expect(errors).not_to have_received(:add).with(attribute, any_args) + expect(errors).to_not have_received(:add).with(attribute, any_args) end end end diff --git a/spec/workers/feed_insert_worker_spec.rb b/spec/workers/feed_insert_worker_spec.rb index fb34970fc..1a723d63a 100644 --- a/spec/workers/feed_insert_worker_spec.rb +++ b/spec/workers/feed_insert_worker_spec.rb @@ -16,7 +16,7 @@ describe FeedInsertWorker do result = subject.perform(nil, follower.id) expect(result).to eq true - expect(instance).not_to have_received(:push_to_home) + expect(instance).to_not have_received(:push_to_home) end it 'skips push with missing account' do @@ -25,7 +25,7 @@ describe FeedInsertWorker do result = subject.perform(status.id, nil) expect(result).to eq true - expect(instance).not_to have_received(:push_to_home) + expect(instance).to_not have_received(:push_to_home) end end @@ -36,7 +36,7 @@ describe FeedInsertWorker do result = subject.perform(status.id, follower.id) expect(result).to be_nil - expect(instance).not_to have_received(:push_to_home) + expect(instance).to_not have_received(:push_to_home) end it 'pushes the status onto the home timeline without filter' do -- cgit From dbc6d7b276aa1ccc085f76caa43cc091311af6b7 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Sun, 19 Feb 2023 20:45:50 -0500 Subject: Autofix Rubocop Lint/UnusedBlockArgument (#23712) --- .rubocop_todo.yml | 8 -------- spec/lib/activitypub/activity/add_spec.rb | 4 ++-- spec/lib/request_pool_spec.rb | 2 +- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 9076891e2..e33d1d745 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -278,14 +278,6 @@ Lint/OrAssignmentToConstant: Exclude: - 'lib/sanitize_ext/sanitize_config.rb' -# Offense count: 3 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments. -Lint/UnusedBlockArgument: - Exclude: - - 'spec/lib/activitypub/activity/add_spec.rb' - - 'spec/lib/request_pool_spec.rb' - # Offense count: 33 Lint/UselessAssignment: Exclude: diff --git a/spec/lib/activitypub/activity/add_spec.rb b/spec/lib/activitypub/activity/add_spec.rb index 0b08e2924..e21c871e6 100644 --- a/spec/lib/activitypub/activity/add_spec.rb +++ b/spec/lib/activitypub/activity/add_spec.rb @@ -48,7 +48,7 @@ RSpec.describe ActivityPub::Activity::Add do end it 'fetches the status and pins it' do - allow(service_stub).to receive(:call) do |uri, id: true, on_behalf_of: nil, request_id: nil| + allow(service_stub).to receive(:call) do |uri, id: true, on_behalf_of: nil, request_id: nil| # rubocop:disable Lint/UnusedBlockArgument expect(uri).to eq 'https://example.com/unknown' expect(id).to eq true expect(on_behalf_of&.following?(sender)).to eq true @@ -62,7 +62,7 @@ RSpec.describe ActivityPub::Activity::Add do context 'when there is no local follower' do it 'tries to fetch the status' do - allow(service_stub).to receive(:call) do |uri, id: true, on_behalf_of: nil, request_id: nil| + allow(service_stub).to receive(:call) do |uri, id: true, on_behalf_of: nil, request_id: nil| # rubocop:disable Lint/UnusedBlockArgument expect(uri).to eq 'https://example.com/unknown' expect(id).to eq true expect(on_behalf_of).to eq nil diff --git a/spec/lib/request_pool_spec.rb b/spec/lib/request_pool_spec.rb index 4a144d7c7..63dc9c5dd 100644 --- a/spec/lib/request_pool_spec.rb +++ b/spec/lib/request_pool_spec.rb @@ -33,7 +33,7 @@ describe RequestPool do subject - threads = 20.times.map do |i| + threads = 20.times.map do |_i| Thread.new do 20.times do subject.with('http://example.com') do |http_client| -- cgit From bd1d57c2303b7a5df1af749d8851c9364a044e77 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Sun, 19 Feb 2023 20:46:00 -0500 Subject: Autofix Rubocop RSpec/EmptyLineAfterSubject (#23719) --- .rubocop_todo.yml | 21 --------------------- .../activitypub/collections_controller_spec.rb | 1 + .../followers_synchronizations_controller_spec.rb | 1 + .../activitypub/outboxes_controller_spec.rb | 1 + .../activitypub/replies_controller_spec.rb | 1 + .../admin/reports/actions_controller_spec.rb | 2 ++ spec/controllers/api/web/embeds_controller_spec.rb | 1 + spec/controllers/emojis_controller_spec.rb | 1 + .../follower_accounts_controller_spec.rb | 1 + .../following_accounts_controller_spec.rb | 1 + spec/controllers/relationships_controller_spec.rb | 1 + spec/lib/activitypub/activity/delete_spec.rb | 2 ++ spec/lib/activitypub/activity/flag_spec.rb | 1 + spec/models/admin/account_action_spec.rb | 1 + spec/models/user_spec.rb | 2 ++ spec/services/fetch_remote_status_service_spec.rb | 1 + spec/workers/refollow_worker_spec.rb | 1 + 17 files changed, 19 insertions(+), 21 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index e33d1d745..02f84e70f 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -817,27 +817,6 @@ RSpec/EmptyExampleGroup: - 'spec/models/web/setting_spec.rb' - 'spec/services/unmute_service_spec.rb' -# Offense count: 19 -# This cop supports safe autocorrection (--autocorrect). -RSpec/EmptyLineAfterSubject: - Exclude: - - 'spec/controllers/activitypub/collections_controller_spec.rb' - - 'spec/controllers/activitypub/followers_synchronizations_controller_spec.rb' - - 'spec/controllers/activitypub/outboxes_controller_spec.rb' - - 'spec/controllers/activitypub/replies_controller_spec.rb' - - 'spec/controllers/admin/reports/actions_controller_spec.rb' - - 'spec/controllers/api/web/embeds_controller_spec.rb' - - 'spec/controllers/emojis_controller_spec.rb' - - 'spec/controllers/follower_accounts_controller_spec.rb' - - 'spec/controllers/following_accounts_controller_spec.rb' - - 'spec/controllers/relationships_controller_spec.rb' - - 'spec/lib/activitypub/activity/delete_spec.rb' - - 'spec/lib/activitypub/activity/flag_spec.rb' - - 'spec/models/admin/account_action_spec.rb' - - 'spec/models/user_spec.rb' - - 'spec/services/fetch_remote_status_service_spec.rb' - - 'spec/workers/refollow_worker_spec.rb' - # Offense count: 178 # Configuration parameters: CountAsOne. RSpec/ExampleLength: diff --git a/spec/controllers/activitypub/collections_controller_spec.rb b/spec/controllers/activitypub/collections_controller_spec.rb index bf81cdb93..19c0e0a64 100644 --- a/spec/controllers/activitypub/collections_controller_spec.rb +++ b/spec/controllers/activitypub/collections_controller_spec.rb @@ -38,6 +38,7 @@ RSpec.describe ActivityPub::CollectionsController, type: :controller do let(:remote_account) { nil } subject(:response) { get :show, params: { id: 'featured', account_username: account.username } } + subject(:body) { body_as_json } it 'returns http success' do diff --git a/spec/controllers/activitypub/followers_synchronizations_controller_spec.rb b/spec/controllers/activitypub/followers_synchronizations_controller_spec.rb index c19bb8cae..893c8e14f 100644 --- a/spec/controllers/activitypub/followers_synchronizations_controller_spec.rb +++ b/spec/controllers/activitypub/followers_synchronizations_controller_spec.rb @@ -35,6 +35,7 @@ RSpec.describe ActivityPub::FollowersSynchronizationsController, type: :controll let(:remote_account) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/instance') } subject(:response) { get :show, params: { account_username: account.username } } + subject(:body) { body_as_json } it 'returns http success' do diff --git a/spec/controllers/activitypub/outboxes_controller_spec.rb b/spec/controllers/activitypub/outboxes_controller_spec.rb index d8d42b7ae..f84a902ea 100644 --- a/spec/controllers/activitypub/outboxes_controller_spec.rb +++ b/spec/controllers/activitypub/outboxes_controller_spec.rb @@ -36,6 +36,7 @@ RSpec.describe ActivityPub::OutboxesController, type: :controller do let(:remote_account) { nil } subject(:response) { get :show, params: { account_username: account.username, page: page } } + subject(:body) { body_as_json } context 'with page not requested' do diff --git a/spec/controllers/activitypub/replies_controller_spec.rb b/spec/controllers/activitypub/replies_controller_spec.rb index 394d4baab..582ef863f 100644 --- a/spec/controllers/activitypub/replies_controller_spec.rb +++ b/spec/controllers/activitypub/replies_controller_spec.rb @@ -181,6 +181,7 @@ RSpec.describe ActivityPub::RepliesController, type: :controller do describe 'GET #index' do subject(:response) { get :index, params: { account_username: status.account.username, status_id: status.id, only_other_accounts: only_other_accounts } } + let(:only_other_accounts) { nil } context 'with no signature' do diff --git a/spec/controllers/admin/reports/actions_controller_spec.rb b/spec/controllers/admin/reports/actions_controller_spec.rb index 9890ac9ce..db3a1d311 100644 --- a/spec/controllers/admin/reports/actions_controller_spec.rb +++ b/spec/controllers/admin/reports/actions_controller_spec.rb @@ -123,11 +123,13 @@ describe Admin::Reports::ActionsController do context 'action as submit button' do subject { post :create, params: { report_id: report.id, text: text, action => '' } } + it_behaves_like 'all action types' end context 'action as submit button' do subject { post :create, params: { report_id: report.id, text: text, moderation_action: action } } + it_behaves_like 'all action types' end end diff --git a/spec/controllers/api/web/embeds_controller_spec.rb b/spec/controllers/api/web/embeds_controller_spec.rb index 345c317ba..b3ef73915 100644 --- a/spec/controllers/api/web/embeds_controller_spec.rb +++ b/spec/controllers/api/web/embeds_controller_spec.rb @@ -11,6 +11,7 @@ describe Api::Web::EmbedsController do describe 'POST #create' do subject(:response) { post :create, params: { url: url } } + subject(:body) { JSON.parse(response.body, symbolize_names: true) } context 'when successfully finds status' do diff --git a/spec/controllers/emojis_controller_spec.rb b/spec/controllers/emojis_controller_spec.rb index fbbd11f64..9f6604964 100644 --- a/spec/controllers/emojis_controller_spec.rb +++ b/spec/controllers/emojis_controller_spec.rb @@ -7,6 +7,7 @@ describe EmojisController do describe 'GET #show' do subject(:response) { get :show, params: { id: emoji.id, format: :json } } + subject(:body) { JSON.parse(response.body, symbolize_names: true) } it 'returns the right response' do diff --git a/spec/controllers/follower_accounts_controller_spec.rb b/spec/controllers/follower_accounts_controller_spec.rb index ab2e82e85..43fc4203c 100644 --- a/spec/controllers/follower_accounts_controller_spec.rb +++ b/spec/controllers/follower_accounts_controller_spec.rb @@ -38,6 +38,7 @@ describe FollowerAccountsController do context 'when format is json' do subject(:response) { get :index, params: { account_username: alice.username, page: page, format: :json } } + subject(:body) { JSON.parse(response.body) } context 'with page' do diff --git a/spec/controllers/following_accounts_controller_spec.rb b/spec/controllers/following_accounts_controller_spec.rb index e43dbf882..b41bf0575 100644 --- a/spec/controllers/following_accounts_controller_spec.rb +++ b/spec/controllers/following_accounts_controller_spec.rb @@ -38,6 +38,7 @@ describe FollowingAccountsController do context 'when format is json' do subject(:response) { get :index, params: { account_username: alice.username, page: page, format: :json } } + subject(:body) { JSON.parse(response.body) } context 'with page' do diff --git a/spec/controllers/relationships_controller_spec.rb b/spec/controllers/relationships_controller_spec.rb index 2056a2ac2..cd09cf50b 100644 --- a/spec/controllers/relationships_controller_spec.rb +++ b/spec/controllers/relationships_controller_spec.rb @@ -51,6 +51,7 @@ describe RelationshipsController do context 'when select parameter is not provided' do subject { patch :update } + include_examples 'redirects back to followers page' end diff --git a/spec/lib/activitypub/activity/delete_spec.rb b/spec/lib/activitypub/activity/delete_spec.rb index 9dfb8a61b..40cd0fce9 100644 --- a/spec/lib/activitypub/activity/delete_spec.rb +++ b/spec/lib/activitypub/activity/delete_spec.rb @@ -30,6 +30,7 @@ RSpec.describe ActivityPub::Activity::Delete do context 'when the status has been reblogged' do describe '#perform' do subject { described_class.new(json, sender) } + let!(:reblogger) { Fabricate(:account) } let!(:follower) { Fabricate(:account, username: 'follower', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox') } let!(:reblog) { Fabricate(:status, account: reblogger, reblog: status) } @@ -53,6 +54,7 @@ RSpec.describe ActivityPub::Activity::Delete do context 'when the status has been reported' do describe '#perform' do subject { described_class.new(json, sender) } + let!(:reporter) { Fabricate(:account) } before do diff --git a/spec/lib/activitypub/activity/flag_spec.rb b/spec/lib/activitypub/activity/flag_spec.rb index 7890fd1e8..c2a505356 100644 --- a/spec/lib/activitypub/activity/flag_spec.rb +++ b/spec/lib/activitypub/activity/flag_spec.rb @@ -110,6 +110,7 @@ RSpec.describe ActivityPub::Activity::Flag do describe '#perform with a defined uri' do subject { described_class.new(json, sender) } + let(:flag_id) { 'http://example.com/reports/1' } before do diff --git a/spec/models/admin/account_action_spec.rb b/spec/models/admin/account_action_spec.rb index b6a052b76..4516df2c2 100644 --- a/spec/models/admin/account_action_spec.rb +++ b/spec/models/admin/account_action_spec.rb @@ -5,6 +5,7 @@ RSpec.describe Admin::AccountAction, type: :model do describe '#save!' do subject { account_action.save! } + let(:account) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:target_account) { Fabricate(:account) } let(:type) { 'disable' } diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index c2f7e99ac..d23439f1a 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -409,6 +409,7 @@ RSpec.describe User, type: :model do describe '#disable!' do subject(:user) { Fabricate(:user, disabled: false, current_sign_in_at: current_sign_in_at, last_sign_in_at: nil) } + let(:current_sign_in_at) { Time.zone.now } before do @@ -497,6 +498,7 @@ RSpec.describe User, type: :model do describe '#active_for_authentication?' do subject { user.active_for_authentication? } + let(:user) { Fabricate(:user, disabled: disabled, confirmed_at: confirmed_at) } context 'when user is disabled' do diff --git a/spec/services/fetch_remote_status_service_spec.rb b/spec/services/fetch_remote_status_service_spec.rb index 02c62f8d6..ace520b8f 100644 --- a/spec/services/fetch_remote_status_service_spec.rb +++ b/spec/services/fetch_remote_status_service_spec.rb @@ -16,6 +16,7 @@ RSpec.describe FetchRemoteStatusService, type: :service do context 'protocol is :activitypub' do subject { described_class.new.call(note[:id], prefetched_body: prefetched_body) } + let(:prefetched_body) { Oj.dump(note) } before do diff --git a/spec/workers/refollow_worker_spec.rb b/spec/workers/refollow_worker_spec.rb index d9c2293b6..1dac15385 100644 --- a/spec/workers/refollow_worker_spec.rb +++ b/spec/workers/refollow_worker_spec.rb @@ -4,6 +4,7 @@ require 'rails_helper' describe RefollowWorker do subject { described_class.new } + let(:account) { Fabricate(:account, domain: 'example.org', protocol: :activitypub) } let(:alice) { Fabricate(:account, domain: nil, username: 'alice') } let(:bob) { Fabricate(:account, domain: nil, username: 'bob') } -- cgit From aef0051fd0723ff03175a8851497056ed07d1a83 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Sun, 19 Feb 2023 21:16:40 -0500 Subject: Enable Rubocop HTTP status rules (#23717) --- .rubocop.yml | 6 + .rubocop_todo.yml | 171 --------------------- app/controllers/api/v1/accounts_controller.rb | 2 +- .../api/v1/emails/confirmations_controller.rb | 4 +- app/controllers/auth/sessions_controller.rb | 4 +- .../concerns/two_factor_authentication_concern.rb | 4 +- .../webauthn_credentials_controller.rb | 2 +- spec/controllers/admin/accounts_controller_spec.rb | 22 +-- spec/controllers/admin/base_controller_spec.rb | 2 +- .../controllers/admin/instances_controller_spec.rb | 2 +- spec/controllers/admin/roles_controller_spec.rb | 16 +- spec/controllers/admin/users/roles_controller.rb | 4 +- .../api/v1/accounts/credentials_controller_spec.rb | 6 +- .../api/v1/accounts/statuses_controller_spec.rb | 10 +- .../v1/announcements/reactions_controller_spec.rb | 4 +- .../api/v1/announcements_controller_spec.rb | 4 +- .../api/v1/apps/credentials_controller_spec.rb | 2 +- .../api/v1/bookmarks_controller_spec.rb | 6 +- .../api/v1/emails/confirmations_controller_spec.rb | 6 +- .../api/v1/favourites_controller_spec.rb | 6 +- spec/controllers/api/v1/media_controller_spec.rb | 6 +- .../api/v1/timelines/home_controller_spec.rb | 2 +- .../api/v1/timelines/list_controller_spec.rb | 4 +- spec/controllers/api/web/embeds_controller_spec.rb | 6 +- .../auth/registrations_controller_spec.rb | 2 +- spec/controllers/auth/sessions_controller_spec.rb | 2 +- .../concerns/export_controller_concern_spec.rb | 2 +- .../disputes/strikes_controller_spec.rb | 2 +- .../settings/applications_controller_spec.rb | 2 +- .../settings/sessions_controller_spec.rb | 2 +- spec/controllers/shares_controller_spec.rb | 2 +- spec/requests/catch_all_route_request_spec.rb | 4 +- 32 files changed, 77 insertions(+), 242 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index fc1969a64..512c8458f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -88,6 +88,9 @@ Metrics/ModuleLength: Metrics/PerceivedComplexity: Max: 16 # RuboCop default 8 +Rails/HttpStatus: + EnforcedStyle: numeric + Rails/Exit: Exclude: - 'lib/mastodon/*_cli.rb' @@ -97,6 +100,9 @@ Rails/Exit: RSpec/NotToNot: EnforcedStyle: to_not +RSpec/Rails/HttpStatus: + EnforcedStyle: numeric + Style/HashSyntax: EnforcedStyle: ruby19_no_mixed_keys diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 02f84e70f..521608de6 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1427,148 +1427,6 @@ RSpec/PredicateMatcher: - 'spec/models/user_spec.rb' - 'spec/services/post_status_service_spec.rb' -# Offense count: 3 -# This cop supports unsafe autocorrection (--autocorrect-all). -RSpec/Rails/HaveHttpStatus: - Exclude: - - 'spec/controllers/settings/applications_controller_spec.rb' - - 'spec/requests/catch_all_route_request_spec.rb' - -# Offense count: 432 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: numeric, symbolic -RSpec/Rails/HttpStatus: - Exclude: - - 'spec/controllers/about_controller_spec.rb' - - 'spec/controllers/accounts_controller_spec.rb' - - 'spec/controllers/activitypub/collections_controller_spec.rb' - - 'spec/controllers/activitypub/followers_synchronizations_controller_spec.rb' - - 'spec/controllers/activitypub/inboxes_controller_spec.rb' - - 'spec/controllers/activitypub/outboxes_controller_spec.rb' - - 'spec/controllers/activitypub/replies_controller_spec.rb' - - 'spec/controllers/admin/accounts_controller_spec.rb' - - 'spec/controllers/admin/action_logs_controller_spec.rb' - - 'spec/controllers/admin/change_email_controller_spec.rb' - - 'spec/controllers/admin/confirmations_controller_spec.rb' - - 'spec/controllers/admin/custom_emojis_controller_spec.rb' - - 'spec/controllers/admin/dashboard_controller_spec.rb' - - 'spec/controllers/admin/domain_allows_controller_spec.rb' - - 'spec/controllers/admin/domain_blocks_controller_spec.rb' - - 'spec/controllers/admin/email_domain_blocks_controller_spec.rb' - - 'spec/controllers/admin/export_domain_allows_controller_spec.rb' - - 'spec/controllers/admin/export_domain_blocks_controller_spec.rb' - - 'spec/controllers/admin/instances_controller_spec.rb' - - 'spec/controllers/admin/reports/actions_controller_spec.rb' - - 'spec/controllers/admin/reports_controller_spec.rb' - - 'spec/controllers/admin/settings/branding_controller_spec.rb' - - 'spec/controllers/admin/statuses_controller_spec.rb' - - 'spec/controllers/admin/tags_controller_spec.rb' - - 'spec/controllers/api/base_controller_spec.rb' - - 'spec/controllers/api/oembed_controller_spec.rb' - - 'spec/controllers/api/v1/accounts/credentials_controller_spec.rb' - - 'spec/controllers/api/v1/accounts/follower_accounts_controller_spec.rb' - - 'spec/controllers/api/v1/accounts/following_accounts_controller_spec.rb' - - 'spec/controllers/api/v1/accounts/lists_controller_spec.rb' - - 'spec/controllers/api/v1/accounts/notes_controller_spec.rb' - - 'spec/controllers/api/v1/accounts/pins_controller_spec.rb' - - 'spec/controllers/api/v1/accounts/relationships_controller_spec.rb' - - 'spec/controllers/api/v1/accounts/search_controller_spec.rb' - - 'spec/controllers/api/v1/accounts_controller_spec.rb' - - 'spec/controllers/api/v1/admin/account_actions_controller_spec.rb' - - 'spec/controllers/api/v1/admin/accounts_controller_spec.rb' - - 'spec/controllers/api/v1/admin/domain_allows_controller_spec.rb' - - 'spec/controllers/api/v1/admin/domain_blocks_controller_spec.rb' - - 'spec/controllers/api/v1/admin/reports_controller_spec.rb' - - 'spec/controllers/api/v1/announcements/reactions_controller_spec.rb' - - 'spec/controllers/api/v1/announcements_controller_spec.rb' - - 'spec/controllers/api/v1/apps/credentials_controller_spec.rb' - - 'spec/controllers/api/v1/apps_controller_spec.rb' - - 'spec/controllers/api/v1/blocks_controller_spec.rb' - - 'spec/controllers/api/v1/conversations_controller_spec.rb' - - 'spec/controllers/api/v1/custom_emojis_controller_spec.rb' - - 'spec/controllers/api/v1/domain_blocks_controller_spec.rb' - - 'spec/controllers/api/v1/endorsements_controller_spec.rb' - - 'spec/controllers/api/v1/filters_controller_spec.rb' - - 'spec/controllers/api/v1/follow_requests_controller_spec.rb' - - 'spec/controllers/api/v1/instances/activity_controller_spec.rb' - - 'spec/controllers/api/v1/instances/peers_controller_spec.rb' - - 'spec/controllers/api/v1/instances_controller_spec.rb' - - 'spec/controllers/api/v1/lists/accounts_controller_spec.rb' - - 'spec/controllers/api/v1/lists_controller_spec.rb' - - 'spec/controllers/api/v1/markers_controller_spec.rb' - - 'spec/controllers/api/v1/media_controller_spec.rb' - - 'spec/controllers/api/v1/mutes_controller_spec.rb' - - 'spec/controllers/api/v1/notifications_controller_spec.rb' - - 'spec/controllers/api/v1/polls/votes_controller_spec.rb' - - 'spec/controllers/api/v1/polls_controller_spec.rb' - - 'spec/controllers/api/v1/reports_controller_spec.rb' - - 'spec/controllers/api/v1/statuses/bookmarks_controller_spec.rb' - - 'spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb' - - 'spec/controllers/api/v1/statuses/favourites_controller_spec.rb' - - 'spec/controllers/api/v1/statuses/histories_controller_spec.rb' - - 'spec/controllers/api/v1/statuses/mutes_controller_spec.rb' - - 'spec/controllers/api/v1/statuses/pins_controller_spec.rb' - - 'spec/controllers/api/v1/statuses/reblogged_by_accounts_controller_spec.rb' - - 'spec/controllers/api/v1/statuses/reblogs_controller_spec.rb' - - 'spec/controllers/api/v1/statuses/sources_controller_spec.rb' - - 'spec/controllers/api/v1/statuses_controller_spec.rb' - - 'spec/controllers/api/v1/streaming_controller_spec.rb' - - 'spec/controllers/api/v1/suggestions_controller_spec.rb' - - 'spec/controllers/api/v1/timelines/home_controller_spec.rb' - - 'spec/controllers/api/v1/timelines/list_controller_spec.rb' - - 'spec/controllers/api/v1/timelines/public_controller_spec.rb' - - 'spec/controllers/api/v1/timelines/tag_controller_spec.rb' - - 'spec/controllers/api/v1/trends/tags_controller_spec.rb' - - 'spec/controllers/api/v2/admin/accounts_controller_spec.rb' - - 'spec/controllers/api/v2/filters/keywords_controller_spec.rb' - - 'spec/controllers/api/v2/filters/statuses_controller_spec.rb' - - 'spec/controllers/api/v2/filters_controller_spec.rb' - - 'spec/controllers/api/v2/search_controller_spec.rb' - - 'spec/controllers/api/web/settings_controller_spec.rb' - - 'spec/controllers/application_controller_spec.rb' - - 'spec/controllers/auth/confirmations_controller_spec.rb' - - 'spec/controllers/auth/passwords_controller_spec.rb' - - 'spec/controllers/auth/registrations_controller_spec.rb' - - 'spec/controllers/auth/sessions_controller_spec.rb' - - 'spec/controllers/authorize_interactions_controller_spec.rb' - - 'spec/controllers/concerns/account_controller_concern_spec.rb' - - 'spec/controllers/concerns/export_controller_concern_spec.rb' - - 'spec/controllers/concerns/signature_verification_spec.rb' - - 'spec/controllers/emojis_controller_spec.rb' - - 'spec/controllers/follower_accounts_controller_spec.rb' - - 'spec/controllers/following_accounts_controller_spec.rb' - - 'spec/controllers/instance_actors_controller_spec.rb' - - 'spec/controllers/intents_controller_spec.rb' - - 'spec/controllers/invites_controller_spec.rb' - - 'spec/controllers/manifests_controller_spec.rb' - - 'spec/controllers/media_controller_spec.rb' - - 'spec/controllers/media_proxy_controller_spec.rb' - - 'spec/controllers/oauth/authorizations_controller_spec.rb' - - 'spec/controllers/oauth/authorized_applications_controller_spec.rb' - - 'spec/controllers/relationships_controller_spec.rb' - - 'spec/controllers/settings/applications_controller_spec.rb' - - 'spec/controllers/settings/deletes_controller_spec.rb' - - 'spec/controllers/settings/exports_controller_spec.rb' - - 'spec/controllers/settings/imports_controller_spec.rb' - - 'spec/controllers/settings/migrations_controller_spec.rb' - - 'spec/controllers/settings/preferences/notifications_controller_spec.rb' - - 'spec/controllers/settings/preferences/other_controller_spec.rb' - - 'spec/controllers/settings/profiles_controller_spec.rb' - - 'spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb' - - 'spec/controllers/settings/two_factor_authentication/otp_authentication_controller_spec.rb' - - 'spec/controllers/settings/two_factor_authentication/recovery_codes_controller_spec.rb' - - 'spec/controllers/settings/two_factor_authentication/webauthn_credentials_controller_spec.rb' - - 'spec/controllers/settings/two_factor_authentication_methods_controller_spec.rb' - - 'spec/controllers/statuses_cleanup_controller_spec.rb' - - 'spec/controllers/statuses_controller_spec.rb' - - 'spec/controllers/tags_controller_spec.rb' - - 'spec/controllers/well_known/host_meta_controller_spec.rb' - - 'spec/controllers/well_known/nodeinfo_controller_spec.rb' - - 'spec/controllers/well_known/webfinger_controller_spec.rb' - - 'spec/requests/host_meta_request_spec.rb' - - 'spec/requests/webfinger_request_spec.rb' - # Offense count: 180 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: Inferences. @@ -2159,35 +2017,6 @@ Rails/HttpPositionalArguments: Exclude: - 'spec/config/initializers/rack_attack_spec.rb' -# Offense count: 49 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: numeric, symbolic -Rails/HttpStatus: - Exclude: - - 'app/controllers/activitypub/inboxes_controller.rb' - - 'app/controllers/api/base_controller.rb' - - 'app/controllers/api/v1/admin/domain_blocks_controller.rb' - - 'app/controllers/api/v1/instances/activity_controller.rb' - - 'app/controllers/api/v1/instances/domain_blocks_controller.rb' - - 'app/controllers/api/v1/instances/peers_controller.rb' - - 'app/controllers/api/v1/lists_controller.rb' - - 'app/controllers/api/v1/markers_controller.rb' - - 'app/controllers/api/v1/media_controller.rb' - - 'app/controllers/api/v1/statuses_controller.rb' - - 'app/controllers/api/v1/streaming_controller.rb' - - 'app/controllers/api/v2/media_controller.rb' - - 'app/controllers/api/v2/search_controller.rb' - - 'app/controllers/api/web/base_controller.rb' - - 'app/controllers/settings/pictures_controller.rb' - - 'app/controllers/well_known/webfinger_controller.rb' - - 'spec/controllers/api/base_controller_spec.rb' - - 'spec/controllers/application_controller_spec.rb' - - 'spec/controllers/concerns/account_controller_concern_spec.rb' - - 'spec/controllers/concerns/localized_spec.rb' - - 'spec/controllers/concerns/rate_limit_headers_spec.rb' - - 'spec/controllers/concerns/signature_verification_spec.rb' - # Offense count: 7 # Configuration parameters: Include. # Include: spec/**/*.rb, test/**/*.rb diff --git a/app/controllers/api/v1/accounts_controller.rb b/app/controllers/api/v1/accounts_controller.rb index be84720aa..7dff66efa 100644 --- a/app/controllers/api/v1/accounts_controller.rb +++ b/app/controllers/api/v1/accounts_controller.rb @@ -30,7 +30,7 @@ class Api::V1::AccountsController < Api::BaseController self.response_body = Oj.dump(response.body) self.status = response.status rescue ActiveRecord::RecordInvalid => e - render json: ValidationErrorFormatter.new(e, 'account.username': :username, 'invite_request.text': :reason).as_json, status: :unprocessable_entity + render json: ValidationErrorFormatter.new(e, 'account.username': :username, 'invite_request.text': :reason).as_json, status: 422 end def follow diff --git a/app/controllers/api/v1/emails/confirmations_controller.rb b/app/controllers/api/v1/emails/confirmations_controller.rb index 3faaea2fb..32fb8e39f 100644 --- a/app/controllers/api/v1/emails/confirmations_controller.rb +++ b/app/controllers/api/v1/emails/confirmations_controller.rb @@ -15,10 +15,10 @@ class Api::V1::Emails::ConfirmationsController < Api::BaseController private def require_user_owned_by_application! - render json: { error: 'This method is only available to the application the user originally signed-up with' }, status: :forbidden unless current_user && current_user.created_by_application_id == doorkeeper_token.application_id + render json: { error: 'This method is only available to the application the user originally signed-up with' }, status: 403 unless current_user && current_user.created_by_application_id == doorkeeper_token.application_id end def require_user_not_confirmed! - render json: { error: 'This method is only available while the e-mail is awaiting confirmation' }, status: :forbidden unless !current_user.confirmed? || current_user.unconfirmed_email.present? + render json: { error: 'This method is only available while the e-mail is awaiting confirmation' }, status: 403 unless !current_user.confirmed? || current_user.unconfirmed_email.present? end end diff --git a/app/controllers/auth/sessions_controller.rb b/app/controllers/auth/sessions_controller.rb index 3ce742638..4f59fd501 100644 --- a/app/controllers/auth/sessions_controller.rb +++ b/app/controllers/auth/sessions_controller.rb @@ -52,9 +52,9 @@ class Auth::SessionsController < Devise::SessionsController session[:webauthn_challenge] = options_for_get.challenge - render json: options_for_get, status: :ok + render json: options_for_get, status: 200 else - render json: { error: t('webauthn_credentials.not_enabled') }, status: :unauthorized + render json: { error: t('webauthn_credentials.not_enabled') }, status: 401 end end diff --git a/app/controllers/concerns/two_factor_authentication_concern.rb b/app/controllers/concerns/two_factor_authentication_concern.rb index e69b67a79..94f3ce00f 100644 --- a/app/controllers/concerns/two_factor_authentication_concern.rb +++ b/app/controllers/concerns/two_factor_authentication_concern.rb @@ -57,10 +57,10 @@ module TwoFactorAuthenticationConcern if valid_webauthn_credential?(user, webauthn_credential) on_authentication_success(user, :webauthn) - render json: { redirect_path: after_sign_in_path_for(user) }, status: :ok + render json: { redirect_path: after_sign_in_path_for(user) }, status: 200 else on_authentication_failure(user, :webauthn, :invalid_credential) - render json: { error: t('webauthn_credentials.invalid_credential') }, status: :unprocessable_entity + render json: { error: t('webauthn_credentials.invalid_credential') }, status: 422 end end diff --git a/app/controllers/settings/two_factor_authentication/webauthn_credentials_controller.rb b/app/controllers/settings/two_factor_authentication/webauthn_credentials_controller.rb index a50d30f06..e43818c94 100644 --- a/app/controllers/settings/two_factor_authentication/webauthn_credentials_controller.rb +++ b/app/controllers/settings/two_factor_authentication/webauthn_credentials_controller.rb @@ -27,7 +27,7 @@ module Settings session[:webauthn_challenge] = options_for_create.challenge - render json: options_for_create, status: :ok + render json: options_for_create, status: 200 end def create diff --git a/spec/controllers/admin/accounts_controller_spec.rb b/spec/controllers/admin/accounts_controller_spec.rb index 35d79740a..f5d68a8ad 100644 --- a/spec/controllers/admin/accounts_controller_spec.rb +++ b/spec/controllers/admin/accounts_controller_spec.rb @@ -83,7 +83,7 @@ RSpec.describe Admin::AccountsController, type: :controller do let(:target_role) { UserRole.find_by(name: 'Admin') } it 'fails to memorialize account' do - is_expected.to have_http_status :forbidden + is_expected.to have_http_status 403 expect(account.reload).to_not be_memorial end end @@ -105,7 +105,7 @@ RSpec.describe Admin::AccountsController, type: :controller do let(:target_role) { UserRole.find_by(name: 'Admin') } it 'fails to memorialize account' do - is_expected.to have_http_status :forbidden + is_expected.to have_http_status 403 expect(account.reload).to_not be_memorial end end @@ -114,7 +114,7 @@ RSpec.describe Admin::AccountsController, type: :controller do let(:target_role) { UserRole.find_by(name: 'Moderator') } it 'fails to memorialize account' do - is_expected.to have_http_status :forbidden + is_expected.to have_http_status 403 expect(account.reload).to_not be_memorial end end @@ -141,7 +141,7 @@ RSpec.describe Admin::AccountsController, type: :controller do let(:role) { UserRole.everyone } it 'fails to enable account' do - is_expected.to have_http_status :forbidden + is_expected.to have_http_status 403 expect(user.reload).to be_disabled end end @@ -167,7 +167,7 @@ RSpec.describe Admin::AccountsController, type: :controller do end it 'logs action' do - is_expected.to have_http_status :found + is_expected.to have_http_status 302 log_item = Admin::ActionLog.last @@ -182,7 +182,7 @@ RSpec.describe Admin::AccountsController, type: :controller do let(:role) { UserRole.everyone } it 'fails to approve account' do - is_expected.to have_http_status :forbidden + is_expected.to have_http_status 403 expect(user.reload).to_not be_approved end end @@ -207,7 +207,7 @@ RSpec.describe Admin::AccountsController, type: :controller do end it 'logs action' do - is_expected.to have_http_status :found + is_expected.to have_http_status 302 log_item = Admin::ActionLog.last @@ -222,7 +222,7 @@ RSpec.describe Admin::AccountsController, type: :controller do let(:role) { UserRole.everyone } it 'fails to reject account' do - is_expected.to have_http_status :forbidden + is_expected.to have_http_status 403 expect(user.reload).to_not be_approved end end @@ -250,7 +250,7 @@ RSpec.describe Admin::AccountsController, type: :controller do let(:role) { UserRole.everyone } it 'fails to redownload' do - is_expected.to have_http_status :forbidden + is_expected.to have_http_status 403 end end end @@ -273,7 +273,7 @@ RSpec.describe Admin::AccountsController, type: :controller do let(:role) { UserRole.everyone } it 'fails to remove avatar' do - is_expected.to have_http_status :forbidden + is_expected.to have_http_status 403 end end end @@ -303,7 +303,7 @@ RSpec.describe Admin::AccountsController, type: :controller do it 'fails to remove avatar' do subject - expect(response).to have_http_status :forbidden + expect(response).to have_http_status 403 end end end diff --git a/spec/controllers/admin/base_controller_spec.rb b/spec/controllers/admin/base_controller_spec.rb index 44be91951..5fbf8777c 100644 --- a/spec/controllers/admin/base_controller_spec.rb +++ b/spec/controllers/admin/base_controller_spec.rb @@ -15,7 +15,7 @@ describe Admin::BaseController, type: :controller do sign_in(Fabricate(:user)) get :success - expect(response).to have_http_status(:forbidden) + expect(response).to have_http_status(403) end it 'renders admin layout as a moderator' do diff --git a/spec/controllers/admin/instances_controller_spec.rb b/spec/controllers/admin/instances_controller_spec.rb index 337f7a80c..a7e348b1c 100644 --- a/spec/controllers/admin/instances_controller_spec.rb +++ b/spec/controllers/admin/instances_controller_spec.rb @@ -50,7 +50,7 @@ RSpec.describe Admin::InstancesController, type: :controller do let(:role) { nil } it 'fails to purge instance' do - is_expected.to have_http_status :forbidden + is_expected.to have_http_status 403 end end end diff --git a/spec/controllers/admin/roles_controller_spec.rb b/spec/controllers/admin/roles_controller_spec.rb index 8ff891205..e2b1030d9 100644 --- a/spec/controllers/admin/roles_controller_spec.rb +++ b/spec/controllers/admin/roles_controller_spec.rb @@ -18,7 +18,7 @@ describe Admin::RolesController do context 'when user does not have permission to manage roles' do it 'returns http forbidden' do - expect(response).to have_http_status(:forbidden) + expect(response).to have_http_status(403) end end @@ -38,7 +38,7 @@ describe Admin::RolesController do context 'when user does not have permission to manage roles' do it 'returns http forbidden' do - expect(response).to have_http_status(:forbidden) + expect(response).to have_http_status(403) end end @@ -128,7 +128,7 @@ describe Admin::RolesController do context 'when user does not have permission to manage roles' do it 'returns http forbidden' do - expect(response).to have_http_status(:forbidden) + expect(response).to have_http_status(403) end end @@ -145,7 +145,7 @@ describe Admin::RolesController do let(:role_position) { current_role.position + 1 } it 'returns http forbidden' do - expect(response).to have_http_status(:forbidden) + expect(response).to have_http_status(403) end end end @@ -165,7 +165,7 @@ describe Admin::RolesController do context 'when user does not have permission to manage roles' do it 'returns http forbidden' do - expect(response).to have_http_status(:forbidden) + expect(response).to have_http_status(403) end it 'does not update the role' do @@ -203,7 +203,7 @@ describe Admin::RolesController do let(:role_position) { current_role.position + 1 } it 'returns http forbidden' do - expect(response).to have_http_status(:forbidden) + expect(response).to have_http_status(403) end it 'does not update the role' do @@ -224,7 +224,7 @@ describe Admin::RolesController do context 'when user does not have permission to manage roles' do it 'returns http forbidden' do - expect(response).to have_http_status(:forbidden) + expect(response).to have_http_status(403) end end @@ -241,7 +241,7 @@ describe Admin::RolesController do let(:role_position) { current_role.position + 1 } it 'returns http forbidden' do - expect(response).to have_http_status(:forbidden) + expect(response).to have_http_status(403) end end end diff --git a/spec/controllers/admin/users/roles_controller.rb b/spec/controllers/admin/users/roles_controller.rb index bd6a3fa67..9fa8aef41 100644 --- a/spec/controllers/admin/users/roles_controller.rb +++ b/spec/controllers/admin/users/roles_controller.rb @@ -26,7 +26,7 @@ describe Admin::Users::RolesController do let(:previous_role) { UserRole.create(name: 'Baz', permissions: UserRole::FLAGS[:administrator], position: 100) } it 'returns http forbidden' do - expect(response).to have_http_status(:forbidden) + expect(response).to have_http_status(403) end end end @@ -74,7 +74,7 @@ describe Admin::Users::RolesController do end it 'returns http forbidden' do - expect(response).to have_http_status(:forbidden) + expect(response).to have_http_status(403) end end end diff --git a/spec/controllers/api/v1/accounts/credentials_controller_spec.rb b/spec/controllers/api/v1/accounts/credentials_controller_spec.rb index a56b9d8fa..cf91aae38 100644 --- a/spec/controllers/api/v1/accounts/credentials_controller_spec.rb +++ b/spec/controllers/api/v1/accounts/credentials_controller_spec.rb @@ -78,7 +78,7 @@ describe Api::V1::Accounts::CredentialsController do end it 'returns http unprocessable entity' do - expect(response).to have_http_status(:unprocessable_entity) + expect(response).to have_http_status(422) end end end @@ -92,14 +92,14 @@ describe Api::V1::Accounts::CredentialsController do describe 'GET #show' do it 'returns http unauthorized' do get :show - expect(response).to have_http_status(:unauthorized) + expect(response).to have_http_status(401) end end describe 'PATCH #update' do it 'returns http unauthorized' do patch :update, params: { note: 'Foo' } - expect(response).to have_http_status(:unauthorized) + expect(response).to have_http_status(401) end end end diff --git a/spec/controllers/api/v1/accounts/statuses_controller_spec.rb b/spec/controllers/api/v1/accounts/statuses_controller_spec.rb index 01d745fc0..4630fac90 100644 --- a/spec/controllers/api/v1/accounts/statuses_controller_spec.rb +++ b/spec/controllers/api/v1/accounts/statuses_controller_spec.rb @@ -16,7 +16,7 @@ describe Api::V1::Accounts::StatusesController do it 'returns http success' do get :index, params: { account_id: user.account.id, limit: 1 } - expect(response).to have_http_status(:ok) + expect(response).to have_http_status(200) end it 'returns expected headers' do @@ -29,7 +29,7 @@ describe Api::V1::Accounts::StatusesController do it 'returns http success' do get :index, params: { account_id: user.account.id, only_media: true } - expect(response).to have_http_status(:ok) + expect(response).to have_http_status(200) end end @@ -44,7 +44,7 @@ describe Api::V1::Accounts::StatusesController do end it 'returns http success' do - expect(response).to have_http_status(:ok) + expect(response).to have_http_status(200) end it 'returns posts along with self replies' do @@ -63,7 +63,7 @@ describe Api::V1::Accounts::StatusesController do it 'returns http success' do get :index, params: { account_id: user.account.id, pinned: true } - expect(response).to have_http_status(:ok) + expect(response).to have_http_status(200) end end @@ -79,7 +79,7 @@ describe Api::V1::Accounts::StatusesController do it 'returns http success' do get :index, params: { account_id: account.id, pinned: true } - expect(response).to have_http_status(:ok) + expect(response).to have_http_status(200) end context 'when user does not follow account' do diff --git a/spec/controllers/api/v1/announcements/reactions_controller_spec.rb b/spec/controllers/api/v1/announcements/reactions_controller_spec.rb index 72620e242..25c52aa1d 100644 --- a/spec/controllers/api/v1/announcements/reactions_controller_spec.rb +++ b/spec/controllers/api/v1/announcements/reactions_controller_spec.rb @@ -15,7 +15,7 @@ RSpec.describe Api::V1::Announcements::ReactionsController, type: :controller do context 'without token' do it 'returns http unauthorized' do put :update, params: { announcement_id: announcement.id, id: '😂' } - expect(response).to have_http_status :unauthorized + expect(response).to have_http_status 401 end end @@ -43,7 +43,7 @@ RSpec.describe Api::V1::Announcements::ReactionsController, type: :controller do context 'without token' do it 'returns http unauthorized' do delete :destroy, params: { announcement_id: announcement.id, id: '😂' } - expect(response).to have_http_status :unauthorized + expect(response).to have_http_status 401 end end diff --git a/spec/controllers/api/v1/announcements_controller_spec.rb b/spec/controllers/api/v1/announcements_controller_spec.rb index 6ee46b60e..eaab2abd8 100644 --- a/spec/controllers/api/v1/announcements_controller_spec.rb +++ b/spec/controllers/api/v1/announcements_controller_spec.rb @@ -15,7 +15,7 @@ RSpec.describe Api::V1::AnnouncementsController, type: :controller do context 'without token' do it 'returns http unprocessable entity' do get :index - expect(response).to have_http_status :unprocessable_entity + expect(response).to have_http_status 422 end end @@ -35,7 +35,7 @@ RSpec.describe Api::V1::AnnouncementsController, type: :controller do context 'without token' do it 'returns http unauthorized' do post :dismiss, params: { id: announcement.id } - expect(response).to have_http_status :unauthorized + expect(response).to have_http_status 401 end end diff --git a/spec/controllers/api/v1/apps/credentials_controller_spec.rb b/spec/controllers/api/v1/apps/credentials_controller_spec.rb index 470093c3c..701ba8acb 100644 --- a/spec/controllers/api/v1/apps/credentials_controller_spec.rb +++ b/spec/controllers/api/v1/apps/credentials_controller_spec.rb @@ -36,7 +36,7 @@ describe Api::V1::Apps::CredentialsController do describe 'GET #show' do it 'returns http unauthorized' do get :show - expect(response).to have_http_status(:unauthorized) + expect(response).to have_http_status(401) end end end diff --git a/spec/controllers/api/v1/bookmarks_controller_spec.rb b/spec/controllers/api/v1/bookmarks_controller_spec.rb index d7c5847b0..279d1a435 100644 --- a/spec/controllers/api/v1/bookmarks_controller_spec.rb +++ b/spec/controllers/api/v1/bookmarks_controller_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Api::V1::BookmarksController, type: :controller do context 'without token' do it 'returns http unauthorized' do get :index - expect(response).to have_http_status :unauthorized + expect(response).to have_http_status 401 end end @@ -24,7 +24,7 @@ RSpec.describe Api::V1::BookmarksController, type: :controller do it 'returns http forbidden' do get :index - expect(response).to have_http_status :forbidden + expect(response).to have_http_status 403 end end @@ -38,7 +38,7 @@ RSpec.describe Api::V1::BookmarksController, type: :controller do it 'returns http unprocessable entity' do get :index - expect(response).to have_http_status :unprocessable_entity + expect(response).to have_http_status 422 end end diff --git a/spec/controllers/api/v1/emails/confirmations_controller_spec.rb b/spec/controllers/api/v1/emails/confirmations_controller_spec.rb index 15ac31cbc..d272ff38d 100644 --- a/spec/controllers/api/v1/emails/confirmations_controller_spec.rb +++ b/spec/controllers/api/v1/emails/confirmations_controller_spec.rb @@ -16,7 +16,7 @@ RSpec.describe Api::V1::Emails::ConfirmationsController, type: :controller do context 'from a random app' do it 'returns http forbidden' do post :create - expect(response).to have_http_status(:forbidden) + expect(response).to have_http_status(403) end end @@ -30,7 +30,7 @@ RSpec.describe Api::V1::Emails::ConfirmationsController, type: :controller do it 'returns http forbidden' do post :create - expect(response).to have_http_status(:forbidden) + expect(response).to have_http_status(403) end context 'but user changed e-mail and has not confirmed it' do @@ -57,7 +57,7 @@ RSpec.describe Api::V1::Emails::ConfirmationsController, type: :controller do context 'without an oauth token' do it 'returns http unauthorized' do post :create - expect(response).to have_http_status(:unauthorized) + expect(response).to have_http_status(401) end end end diff --git a/spec/controllers/api/v1/favourites_controller_spec.rb b/spec/controllers/api/v1/favourites_controller_spec.rb index 231f76500..512dd0c0d 100644 --- a/spec/controllers/api/v1/favourites_controller_spec.rb +++ b/spec/controllers/api/v1/favourites_controller_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Api::V1::FavouritesController, type: :controller do context 'without token' do it 'returns http unauthorized' do get :index - expect(response).to have_http_status :unauthorized + expect(response).to have_http_status 401 end end @@ -24,7 +24,7 @@ RSpec.describe Api::V1::FavouritesController, type: :controller do it 'returns http forbidden' do get :index - expect(response).to have_http_status :forbidden + expect(response).to have_http_status 403 end end @@ -38,7 +38,7 @@ RSpec.describe Api::V1::FavouritesController, type: :controller do it 'returns http unprocessable entity' do get :index - expect(response).to have_http_status :unprocessable_entity + expect(response).to have_http_status 422 end end diff --git a/spec/controllers/api/v1/media_controller_spec.rb b/spec/controllers/api/v1/media_controller_spec.rb index a1f6ddb24..ef1e439f9 100644 --- a/spec/controllers/api/v1/media_controller_spec.rb +++ b/spec/controllers/api/v1/media_controller_spec.rb @@ -19,7 +19,7 @@ RSpec.describe Api::V1::MediaController, type: :controller do end it 'returns http 422' do - expect(response).to have_http_status(:unprocessable_entity) + expect(response).to have_http_status(422) end end @@ -106,7 +106,7 @@ RSpec.describe Api::V1::MediaController, type: :controller do it 'returns http not found' do put :update, params: { id: media.id, description: 'Lorem ipsum!!!' } - expect(response).to have_http_status(:not_found) + expect(response).to have_http_status(404) end end @@ -126,7 +126,7 @@ RSpec.describe Api::V1::MediaController, type: :controller do let(:status) { Fabricate(:status, account: user.account) } it 'returns http not found' do - expect(response).to have_http_status(:not_found) + expect(response).to have_http_status(404) end end end diff --git a/spec/controllers/api/v1/timelines/home_controller_spec.rb b/spec/controllers/api/v1/timelines/home_controller_spec.rb index 131c2d92f..bb46d0aba 100644 --- a/spec/controllers/api/v1/timelines/home_controller_spec.rb +++ b/spec/controllers/api/v1/timelines/home_controller_spec.rb @@ -36,7 +36,7 @@ describe Api::V1::Timelines::HomeController do it 'returns http unprocessable entity' do get :show - expect(response).to have_http_status(:unprocessable_entity) + expect(response).to have_http_status(422) expect(response.headers['Link']).to be_nil end end diff --git a/spec/controllers/api/v1/timelines/list_controller_spec.rb b/spec/controllers/api/v1/timelines/list_controller_spec.rb index 526c66a05..4ef5d41af 100644 --- a/spec/controllers/api/v1/timelines/list_controller_spec.rb +++ b/spec/controllers/api/v1/timelines/list_controller_spec.rb @@ -36,7 +36,7 @@ describe Api::V1::Timelines::ListController do describe 'GET #show' do it 'returns http not found' do get :show, params: { id: list.id } - expect(response).to have_http_status(:not_found) + expect(response).to have_http_status(404) end end end @@ -48,7 +48,7 @@ describe Api::V1::Timelines::ListController do it 'returns http unprocessable entity' do get :show, params: { id: list.id } - expect(response).to have_http_status(:unprocessable_entity) + expect(response).to have_http_status(422) expect(response.headers['Link']).to be_nil end end diff --git a/spec/controllers/api/web/embeds_controller_spec.rb b/spec/controllers/api/web/embeds_controller_spec.rb index b3ef73915..e03f5a371 100644 --- a/spec/controllers/api/web/embeds_controller_spec.rb +++ b/spec/controllers/api/web/embeds_controller_spec.rb @@ -19,7 +19,7 @@ describe Api::Web::EmbedsController do let(:url) { "http://#{Rails.configuration.x.web_domain}/@#{status.account.username}/#{status.id}" } it 'returns a right response' do - expect(response).to have_http_status :ok + expect(response).to have_http_status 200 expect(body[:author_name]).to eq status.account.username end end @@ -37,7 +37,7 @@ describe Api::Web::EmbedsController do let(:call_result) { { result: :ok } } it 'returns a right response' do - expect(response).to have_http_status :ok + expect(response).to have_http_status 200 expect(body[:result]).to eq 'ok' end end @@ -46,7 +46,7 @@ describe Api::Web::EmbedsController do let(:call_result) { nil } it 'returns a right response' do - expect(response).to have_http_status :not_found + expect(response).to have_http_status 404 end end end diff --git a/spec/controllers/auth/registrations_controller_spec.rb b/spec/controllers/auth/registrations_controller_spec.rb index 7298bde00..52023eb2e 100644 --- a/spec/controllers/auth/registrations_controller_spec.rb +++ b/spec/controllers/auth/registrations_controller_spec.rb @@ -245,7 +245,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do end it 'returns http not found' do - expect(response).to have_http_status(:not_found) + expect(response).to have_http_status(404) end it 'does not delete user' do diff --git a/spec/controllers/auth/sessions_controller_spec.rb b/spec/controllers/auth/sessions_controller_spec.rb index eb03dff50..58befa124 100644 --- a/spec/controllers/auth/sessions_controller_spec.rb +++ b/spec/controllers/auth/sessions_controller_spec.rb @@ -422,7 +422,7 @@ RSpec.describe Auth::SessionsController, type: :controller do it 'returns http success' do get :webauthn_options - expect(response).to have_http_status :ok + expect(response).to have_http_status 200 end end end diff --git a/spec/controllers/concerns/export_controller_concern_spec.rb b/spec/controllers/concerns/export_controller_concern_spec.rb index 1a5e46f8e..003fd17f6 100644 --- a/spec/controllers/concerns/export_controller_concern_spec.rb +++ b/spec/controllers/concerns/export_controller_concern_spec.rb @@ -29,7 +29,7 @@ describe ApplicationController, type: :controller do it 'returns unauthorized when not signed in' do get :index, format: :csv - expect(response).to have_http_status(:unauthorized) + expect(response).to have_http_status(401) end end end diff --git a/spec/controllers/disputes/strikes_controller_spec.rb b/spec/controllers/disputes/strikes_controller_spec.rb index 157f9ec3c..e060d37ac 100644 --- a/spec/controllers/disputes/strikes_controller_spec.rb +++ b/spec/controllers/disputes/strikes_controller_spec.rb @@ -23,7 +23,7 @@ RSpec.describe Disputes::StrikesController, type: :controller do let(:strike) { Fabricate(:account_warning) } it 'returns http forbidden' do - expect(response).to have_http_status(:forbidden) + expect(response).to have_http_status(403) end end end diff --git a/spec/controllers/settings/applications_controller_spec.rb b/spec/controllers/settings/applications_controller_spec.rb index 35ad4b2e7..33d874d10 100644 --- a/spec/controllers/settings/applications_controller_spec.rb +++ b/spec/controllers/settings/applications_controller_spec.rb @@ -32,7 +32,7 @@ describe Settings::ApplicationsController do app.update!(owner: nil) get :show, params: { id: app.id } - expect(response.status).to eq 404 + expect(response).to have_http_status 404 end end diff --git a/spec/controllers/settings/sessions_controller_spec.rb b/spec/controllers/settings/sessions_controller_spec.rb index 0e312c5a6..59c18889e 100644 --- a/spec/controllers/settings/sessions_controller_spec.rb +++ b/spec/controllers/settings/sessions_controller_spec.rb @@ -24,7 +24,7 @@ describe Settings::SessionsController do let(:id) { session_activation.id + 1000 } it 'destroys session activation' do - is_expected.to have_http_status :not_found + is_expected.to have_http_status 404 end end end diff --git a/spec/controllers/shares_controller_spec.rb b/spec/controllers/shares_controller_spec.rb index e365b356e..0fde8c692 100644 --- a/spec/controllers/shares_controller_spec.rb +++ b/spec/controllers/shares_controller_spec.rb @@ -13,7 +13,7 @@ describe SharesController do before { get :show, params: { title: 'test title', text: 'test text', url: 'url1 url2' } } it 'returns http success' do - expect(response).to have_http_status :ok + expect(response).to have_http_status 200 expect(body_classes).to eq 'modal-layout compose-standalone' end end diff --git a/spec/requests/catch_all_route_request_spec.rb b/spec/requests/catch_all_route_request_spec.rb index fb18965d8..dcfc1bf4b 100644 --- a/spec/requests/catch_all_route_request_spec.rb +++ b/spec/requests/catch_all_route_request_spec.rb @@ -5,7 +5,7 @@ describe 'The catch all route' do it 'returns a 404 page as html' do get '/test' - expect(response.status).to eq 404 + expect(response).to have_http_status 404 expect(response.media_type).to eq 'text/html' end end @@ -14,7 +14,7 @@ describe 'The catch all route' do it 'returns a 404 page as html' do get '/test.test' - expect(response.status).to eq 404 + expect(response).to have_http_status 404 expect(response.media_type).to eq 'text/html' end end -- cgit From 5179c47087e7807162f1466ec61a797586de007f Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Sun, 19 Feb 2023 21:17:41 -0500 Subject: Autofix Rubocops RSpec/ScatteredLet (#23725) --- .rubocop_todo.yml | 13 ------ .../admin/domain_blocks_controller_spec.rb | 9 ++--- .../api/v1/admin/domain_blocks_controller_spec.rb | 9 ++--- .../api/v1/push/subscriptions_controller_spec.rb | 14 +++---- spec/lib/activitypub/activity/create_spec.rb | 46 ++++++++++------------ spec/lib/vacuum/media_attachments_vacuum_spec.rb | 5 +-- .../process_status_update_service_spec.rb | 28 ++++++------- spec/services/fan_out_on_write_service_spec.rb | 3 +- spec/services/import_service_spec.rb | 12 +++--- 9 files changed, 56 insertions(+), 83 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 521608de6..308e0e69e 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1629,19 +1629,6 @@ RSpec/RepeatedExampleGroupDescription: - 'spec/controllers/admin/reports/actions_controller_spec.rb' - 'spec/policies/report_note_policy_spec.rb' -# Offense count: 18 -# This cop supports safe autocorrection (--autocorrect). -RSpec/ScatteredLet: - Exclude: - - 'spec/controllers/admin/domain_blocks_controller_spec.rb' - - 'spec/controllers/api/v1/admin/domain_blocks_controller_spec.rb' - - 'spec/controllers/api/v1/push/subscriptions_controller_spec.rb' - - 'spec/lib/activitypub/activity/create_spec.rb' - - 'spec/lib/vacuum/media_attachments_vacuum_spec.rb' - - 'spec/services/activitypub/process_status_update_service_spec.rb' - - 'spec/services/fan_out_on_write_service_spec.rb' - - 'spec/services/import_service_spec.rb' - # Offense count: 12 RSpec/ScatteredSetup: Exclude: diff --git a/spec/controllers/admin/domain_blocks_controller_spec.rb b/spec/controllers/admin/domain_blocks_controller_spec.rb index 92fc19efa..d58a0cafc 100644 --- a/spec/controllers/admin/domain_blocks_controller_spec.rb +++ b/spec/controllers/admin/domain_blocks_controller_spec.rb @@ -72,16 +72,15 @@ RSpec.describe Admin::DomainBlocksController, type: :controller do describe 'PUT #update' do let!(:remote_account) { Fabricate(:account, domain: 'example.com') } - let(:domain_block) { Fabricate(:domain_block, domain: 'example.com', severity: original_severity) } + let(:subject) do + post :update, params: { id: domain_block.id, domain_block: { domain: 'example.com', severity: new_severity } } + end + let(:domain_block) { Fabricate(:domain_block, domain: 'example.com', severity: original_severity) } before do BlockDomainService.new.call(domain_block) end - let(:subject) do - post :update, params: { id: domain_block.id, domain_block: { domain: 'example.com', severity: new_severity } } - end - context 'downgrading a domain suspension to silence' do let(:original_severity) { 'suspend' } let(:new_severity) { 'silence' } diff --git a/spec/controllers/api/v1/admin/domain_blocks_controller_spec.rb b/spec/controllers/api/v1/admin/domain_blocks_controller_spec.rb index 606def602..b367ab9ce 100644 --- a/spec/controllers/api/v1/admin/domain_blocks_controller_spec.rb +++ b/spec/controllers/api/v1/admin/domain_blocks_controller_spec.rb @@ -73,16 +73,15 @@ RSpec.describe Api::V1::Admin::DomainBlocksController, type: :controller do describe 'PUT #update' do let!(:remote_account) { Fabricate(:account, domain: 'example.com') } - let(:domain_block) { Fabricate(:domain_block, domain: 'example.com', severity: original_severity) } + let(:subject) do + post :update, params: { id: domain_block.id, domain: 'example.com', severity: new_severity } + end + let(:domain_block) { Fabricate(:domain_block, domain: 'example.com', severity: original_severity) } before do BlockDomainService.new.call(domain_block) end - let(:subject) do - post :update, params: { id: domain_block.id, domain: 'example.com', severity: new_severity } - end - context 'downgrading a domain suspension to silence' do let(:original_severity) { 'suspend' } let(:new_severity) { 'silence' } diff --git a/spec/controllers/api/v1/push/subscriptions_controller_spec.rb b/spec/controllers/api/v1/push/subscriptions_controller_spec.rb index 67f09da2d..168191468 100644 --- a/spec/controllers/api/v1/push/subscriptions_controller_spec.rb +++ b/spec/controllers/api/v1/push/subscriptions_controller_spec.rb @@ -5,13 +5,7 @@ require 'rails_helper' describe Api::V1::Push::SubscriptionsController do render_views - let(:user) { Fabricate(:user) } - let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'push') } - - before do - allow(controller).to receive(:doorkeeper_token) { token } - end - + let(:user) { Fabricate(:user) } let(:create_payload) do { subscription: { @@ -23,7 +17,6 @@ describe Api::V1::Push::SubscriptionsController do }, }.with_indifferent_access end - let(:alerts_payload) do { data: { @@ -41,6 +34,11 @@ describe Api::V1::Push::SubscriptionsController do }, }.with_indifferent_access end + let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'push') } + + before do + allow(controller).to receive(:doorkeeper_token) { token } + end describe 'POST #create' do before do diff --git a/spec/lib/activitypub/activity/create_spec.rb b/spec/lib/activitypub/activity/create_spec.rb index 132e0c31c..ddbdb07aa 100644 --- a/spec/lib/activitypub/activity/create_spec.rb +++ b/spec/lib/activitypub/activity/create_spec.rb @@ -753,10 +753,6 @@ RSpec.describe ActivityPub::Activity::Create do context 'with an encrypted message' do let(:recipient) { Fabricate(:account) } - let(:target_device) { Fabricate(:device, account: recipient) } - - subject { described_class.new(json, sender, delivery: true, delivered_to_account_id: recipient.id) } - let(:object_json) do { id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join, @@ -778,6 +774,9 @@ RSpec.describe ActivityPub::Activity::Create do }, } end + let(:target_device) { Fabricate(:device, account: recipient) } + + subject { described_class.new(json, sender, delivery: true, delivered_to_account_id: recipient.id) } before do subject.perform @@ -833,13 +832,6 @@ RSpec.describe ActivityPub::Activity::Create do context 'when sender replies to local status' do let!(:local_status) { Fabricate(:status) } - - subject { described_class.new(json, sender, delivery: true) } - - before do - subject.perform - end - let(:object_json) do { id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join, @@ -849,6 +841,12 @@ RSpec.describe ActivityPub::Activity::Create do } end + subject { described_class.new(json, sender, delivery: true) } + + before do + subject.perform + end + it 'creates status' do status = sender.statuses.first @@ -859,13 +857,6 @@ RSpec.describe ActivityPub::Activity::Create do context 'when sender targets a local user' do let!(:local_account) { Fabricate(:account) } - - subject { described_class.new(json, sender, delivery: true) } - - before do - subject.perform - end - let(:object_json) do { id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join, @@ -875,6 +866,12 @@ RSpec.describe ActivityPub::Activity::Create do } end + subject { described_class.new(json, sender, delivery: true) } + + before do + subject.perform + end + it 'creates status' do status = sender.statuses.first @@ -885,13 +882,6 @@ RSpec.describe ActivityPub::Activity::Create do context 'when sender cc\'s a local user' do let!(:local_account) { Fabricate(:account) } - - subject { described_class.new(json, sender, delivery: true) } - - before do - subject.perform - end - let(:object_json) do { id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join, @@ -901,6 +891,12 @@ RSpec.describe ActivityPub::Activity::Create do } end + subject { described_class.new(json, sender, delivery: true) } + + before do + subject.perform + end + it 'creates status' do status = sender.statuses.first diff --git a/spec/lib/vacuum/media_attachments_vacuum_spec.rb b/spec/lib/vacuum/media_attachments_vacuum_spec.rb index be8458d9b..436237b25 100644 --- a/spec/lib/vacuum/media_attachments_vacuum_spec.rb +++ b/spec/lib/vacuum/media_attachments_vacuum_spec.rb @@ -2,12 +2,11 @@ require 'rails_helper' RSpec.describe Vacuum::MediaAttachmentsVacuum do let(:retention_period) { 7.days } - - subject { described_class.new(retention_period) } - let(:remote_status) { Fabricate(:status, account: Fabricate(:account, domain: 'example.com')) } let(:local_status) { Fabricate(:status) } + subject { described_class.new(retention_period) } + describe '#perform' do let!(:old_remote_media) { Fabricate(:media_attachment, remote_url: 'https://example.com/foo.png', status: remote_status, created_at: (retention_period + 1.day).ago, updated_at: (retention_period + 1.day).ago) } let!(:old_local_media) { Fabricate(:media_attachment, status: local_status, created_at: (retention_period + 1.day).ago, updated_at: (retention_period + 1.day).ago) } diff --git a/spec/services/activitypub/process_status_update_service_spec.rb b/spec/services/activitypub/process_status_update_service_spec.rb index ae7db88bf..9a6d75ec0 100644 --- a/spec/services/activitypub/process_status_update_service_spec.rb +++ b/spec/services/activitypub/process_status_update_service_spec.rb @@ -6,20 +6,6 @@ end RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do let!(:status) { Fabricate(:status, text: 'Hello world', account: Fabricate(:account, domain: 'example.com')) } - - let(:alice) { Fabricate(:account) } - let(:bob) { Fabricate(:account) } - - let(:mentions) { [] } - let(:tags) { [] } - let(:media_attachments) { [] } - - before do - mentions.each { |a| Fabricate(:mention, status: status, account: a) } - tags.each { |t| status.tags << t } - media_attachments.each { |m| status.media_attachments << m } - end - let(:payload) do { '@context': 'https://www.w3.org/ns/activitystreams', @@ -34,9 +20,21 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do ], } end - let(:json) { Oj.load(Oj.dump(payload)) } + let(:alice) { Fabricate(:account) } + let(:bob) { Fabricate(:account) } + + let(:mentions) { [] } + let(:tags) { [] } + let(:media_attachments) { [] } + + before do + mentions.each { |a| Fabricate(:mention, status: status, account: a) } + tags.each { |t| status.tags << t } + media_attachments.each { |m| status.media_attachments << m } + end + subject { described_class.new } describe '#call' do diff --git a/spec/services/fan_out_on_write_service_spec.rb b/spec/services/fan_out_on_write_service_spec.rb index 59e15d230..3c294cf95 100644 --- a/spec/services/fan_out_on_write_service_spec.rb +++ b/spec/services/fan_out_on_write_service_spec.rb @@ -2,6 +2,7 @@ require 'rails_helper' RSpec.describe FanOutOnWriteService, type: :service do let(:last_active_at) { Time.now.utc } + let(:status) { Fabricate(:status, account: alice, visibility: visibility, text: 'Hello @bob #hoge') } let!(:alice) { Fabricate(:user, current_sign_in_at: last_active_at).account } let!(:bob) { Fabricate(:user, current_sign_in_at: last_active_at, account_attributes: { username: 'bob' }).account } @@ -9,8 +10,6 @@ RSpec.describe FanOutOnWriteService, type: :service do subject { described_class.new } - let(:status) { Fabricate(:status, account: alice, visibility: visibility, text: 'Hello @bob #hoge') } - before do bob.follow!(alice) tom.follow!(alice) diff --git a/spec/services/import_service_spec.rb b/spec/services/import_service_spec.rb index 2b1516ff0..4a517fb93 100644 --- a/spec/services/import_service_spec.rb +++ b/spec/services/import_service_spec.rb @@ -183,15 +183,14 @@ RSpec.describe ImportService, type: :service do subject { ImportService.new } let!(:nare) { Fabricate(:account, username: 'nare', domain: 'թութ.հայ', locked: false, protocol: :activitypub, inbox_url: 'https://թութ.հայ/inbox') } + let(:csv) { attachment_fixture('utf8-followers.txt') } + let(:import) { Import.create(account: account, type: 'following', data: csv) } # Make sure to not actually go to the remote server before do stub_request(:post, 'https://թութ.հայ/inbox').to_return(status: 200) end - let(:csv) { attachment_fixture('utf8-followers.txt') } - let(:import) { Import.create(account: account, type: 'following', data: csv) } - it 'follows the listed account' do expect(account.follow_requests.count).to eq 0 subject.call(import) @@ -203,6 +202,9 @@ RSpec.describe ImportService, type: :service do subject { ImportService.new } let(:csv) { attachment_fixture('bookmark-imports.txt') } + let(:local_account) { Fabricate(:account, username: 'foo', domain: '') } + let!(:remote_status) { Fabricate(:status, uri: 'https://example.com/statuses/1312') } + let!(:direct_status) { Fabricate(:status, uri: 'https://example.com/statuses/direct', visibility: :direct) } around(:each) do |example| local_before = Rails.configuration.x.local_domain @@ -214,10 +216,6 @@ RSpec.describe ImportService, type: :service do Rails.configuration.x.local_domain = local_before end - let(:local_account) { Fabricate(:account, username: 'foo', domain: '') } - let!(:remote_status) { Fabricate(:status, uri: 'https://example.com/statuses/1312') } - let!(:direct_status) { Fabricate(:status, uri: 'https://example.com/statuses/direct', visibility: :direct) } - before do service = double allow(ActivityPub::FetchRemoteStatusService).to receive(:new).and_return(service) -- cgit From f0e1b12c101e0dd0ddaaef8bdcc166624dba62d5 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Sun, 19 Feb 2023 21:18:08 -0500 Subject: Autofix Rubocop Style/ExplicitBlockArgument (#23704) --- .rubocop_todo.yml | 6 ------ app/mailers/application_mailer.rb | 6 ++---- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 308e0e69e..c452d1bd2 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -2323,12 +2323,6 @@ Style/ConcatArrayLiterals: Style/Documentation: Enabled: false -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Style/ExplicitBlockArgument: - Exclude: - - 'app/mailers/application_mailer.rb' - # Offense count: 10 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowedVars. diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index a37682eca..73b623576 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -9,9 +9,7 @@ class ApplicationMailer < ActionMailer::Base protected - def locale_for_account(account) - I18n.with_locale(account.user_locale || I18n.default_locale) do - yield - end + def locale_for_account(account, &block) + I18n.with_locale(account.user_locale || I18n.default_locale, &block) end end -- cgit From 44a7d87cb1f5df953b6c14c16c59e2e4ead1bcb9 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Mon, 20 Feb 2023 03:20:59 +0100 Subject: Rename JSX files with proper `.jsx` extension (#23733) --- .eslintrc.js | 5 +- .github/workflows/lint-js.yml | 2 + .github/workflows/test-js.yml | 2 + .../__snapshots__/autosuggest_emoji-test.js.snap | 27 - .../__snapshots__/autosuggest_emoji-test.jsx.snap | 27 + .../__tests__/__snapshots__/avatar-test.js.snap | 39 -- .../__tests__/__snapshots__/avatar-test.jsx.snap | 39 ++ .../__snapshots__/avatar_overlay-test.js.snap | 54 -- .../__snapshots__/avatar_overlay-test.jsx.snap | 54 ++ .../__tests__/__snapshots__/button-test.js.snap | 66 -- .../__tests__/__snapshots__/button-test.jsx.snap | 66 ++ .../__snapshots__/display_name-test.js.snap | 27 - .../__snapshots__/display_name-test.jsx.snap | 27 + .../components/__tests__/autosuggest_emoji-test.js | 29 - .../__tests__/autosuggest_emoji-test.jsx | 29 + .../mastodon/components/__tests__/avatar-test.js | 36 -- .../mastodon/components/__tests__/avatar-test.jsx | 36 ++ .../components/__tests__/avatar_overlay-test.js | 29 - .../components/__tests__/avatar_overlay-test.jsx | 29 + .../mastodon/components/__tests__/button-test.js | 75 --- .../mastodon/components/__tests__/button-test.jsx | 75 +++ .../components/__tests__/display_name-test.js | 18 - .../components/__tests__/display_name-test.jsx | 18 + app/javascript/mastodon/components/account.js | 157 ----- app/javascript/mastodon/components/account.jsx | 157 +++++ .../mastodon/components/admin/Counter.js | 117 ---- .../mastodon/components/admin/Counter.jsx | 117 ++++ .../mastodon/components/admin/Dimension.js | 93 --- .../mastodon/components/admin/Dimension.jsx | 93 +++ .../components/admin/ReportReasonSelector.js | 159 ----- .../components/admin/ReportReasonSelector.jsx | 159 +++++ .../mastodon/components/admin/Retention.js | 151 ----- .../mastodon/components/admin/Retention.jsx | 151 +++++ app/javascript/mastodon/components/admin/Trends.js | 73 --- .../mastodon/components/admin/Trends.jsx | 73 +++ .../mastodon/components/animated_number.js | 76 --- .../mastodon/components/animated_number.jsx | 76 +++ .../mastodon/components/attachment_list.js | 48 -- .../mastodon/components/attachment_list.jsx | 48 ++ .../mastodon/components/autosuggest_emoji.js | 41 -- .../mastodon/components/autosuggest_emoji.jsx | 41 ++ .../mastodon/components/autosuggest_hashtag.js | 42 -- .../mastodon/components/autosuggest_hashtag.jsx | 42 ++ .../mastodon/components/autosuggest_input.js | 227 ------- .../mastodon/components/autosuggest_input.jsx | 227 +++++++ .../mastodon/components/autosuggest_textarea.js | 235 ------- .../mastodon/components/autosuggest_textarea.jsx | 235 +++++++ app/javascript/mastodon/components/avatar.js | 62 -- app/javascript/mastodon/components/avatar.jsx | 62 ++ .../mastodon/components/avatar_composite.js | 103 ---- .../mastodon/components/avatar_composite.jsx | 103 ++++ .../mastodon/components/avatar_overlay.js | 51 -- .../mastodon/components/avatar_overlay.jsx | 51 ++ app/javascript/mastodon/components/blurhash.js | 65 -- app/javascript/mastodon/components/blurhash.jsx | 65 ++ app/javascript/mastodon/components/button.js | 57 -- app/javascript/mastodon/components/button.jsx | 57 ++ app/javascript/mastodon/components/check.js | 9 - app/javascript/mastodon/components/check.jsx | 9 + app/javascript/mastodon/components/column.js | 62 -- app/javascript/mastodon/components/column.jsx | 62 ++ .../mastodon/components/column_back_button.js | 54 -- .../mastodon/components/column_back_button.jsx | 54 ++ .../mastodon/components/column_back_button_slim.js | 19 - .../components/column_back_button_slim.jsx | 19 + .../mastodon/components/column_header.js | 215 ------- .../mastodon/components/column_header.jsx | 215 +++++++ .../mastodon/components/common_counter.js | 62 -- .../mastodon/components/common_counter.jsx | 62 ++ .../mastodon/components/dismissable_banner.js | 51 -- .../mastodon/components/dismissable_banner.jsx | 51 ++ app/javascript/mastodon/components/display_name.js | 79 --- .../mastodon/components/display_name.jsx | 79 +++ app/javascript/mastodon/components/domain.js | 42 -- app/javascript/mastodon/components/domain.jsx | 42 ++ .../mastodon/components/dropdown_menu.js | 335 ---------- .../mastodon/components/dropdown_menu.jsx | 335 ++++++++++ .../mastodon/components/edited_timestamp/index.js | 70 --- .../mastodon/components/edited_timestamp/index.jsx | 70 +++ .../mastodon/components/error_boundary.js | 107 ---- .../mastodon/components/error_boundary.jsx | 107 ++++ app/javascript/mastodon/components/gifv.js | 73 --- app/javascript/mastodon/components/gifv.jsx | 73 +++ app/javascript/mastodon/components/hashtag.js | 113 ---- app/javascript/mastodon/components/hashtag.jsx | 113 ++++ app/javascript/mastodon/components/icon.js | 21 - app/javascript/mastodon/components/icon.jsx | 21 + app/javascript/mastodon/components/icon_button.js | 164 ----- app/javascript/mastodon/components/icon_button.jsx | 164 +++++ .../mastodon/components/icon_with_badge.js | 22 - .../mastodon/components/icon_with_badge.jsx | 22 + app/javascript/mastodon/components/image.js | 33 - app/javascript/mastodon/components/image.jsx | 33 + .../mastodon/components/inline_account.js | 34 - .../mastodon/components/inline_account.jsx | 34 + .../components/intersection_observer_article.js | 130 ---- .../components/intersection_observer_article.jsx | 130 ++++ app/javascript/mastodon/components/load_gap.js | 34 - app/javascript/mastodon/components/load_gap.jsx | 34 + app/javascript/mastodon/components/load_more.js | 27 - app/javascript/mastodon/components/load_more.jsx | 27 + app/javascript/mastodon/components/load_pending.js | 22 - .../mastodon/components/load_pending.jsx | 22 + .../mastodon/components/loading_indicator.js | 32 - .../mastodon/components/loading_indicator.jsx | 32 + app/javascript/mastodon/components/logo.js | 10 - app/javascript/mastodon/components/logo.jsx | 10 + .../mastodon/components/media_attachments.js | 116 ---- .../mastodon/components/media_attachments.jsx | 116 ++++ .../mastodon/components/media_gallery.js | 368 ----------- .../mastodon/components/media_gallery.jsx | 368 +++++++++++ .../mastodon/components/missing_indicator.js | 29 - .../mastodon/components/missing_indicator.jsx | 29 + app/javascript/mastodon/components/modal_root.js | 157 ----- app/javascript/mastodon/components/modal_root.jsx | 157 +++++ .../mastodon/components/navigation_portal.js | 35 -- .../mastodon/components/navigation_portal.jsx | 35 ++ .../mastodon/components/not_signed_in_indicator.js | 12 - .../components/not_signed_in_indicator.jsx | 12 + .../components/picture_in_picture_placeholder.js | 69 --- .../components/picture_in_picture_placeholder.jsx | 69 +++ app/javascript/mastodon/components/poll.js | 233 ------- app/javascript/mastodon/components/poll.jsx | 233 +++++++ app/javascript/mastodon/components/radio_button.js | 35 -- .../mastodon/components/radio_button.jsx | 35 ++ .../mastodon/components/regeneration_indicator.js | 18 - .../mastodon/components/regeneration_indicator.jsx | 18 + .../mastodon/components/relative_timestamp.js | 199 ------ .../mastodon/components/relative_timestamp.jsx | 199 ++++++ .../mastodon/components/scrollable_list.js | 367 ----------- .../mastodon/components/scrollable_list.jsx | 367 +++++++++++ .../mastodon/components/server_banner.js | 93 --- .../mastodon/components/server_banner.jsx | 93 +++ app/javascript/mastodon/components/short_number.js | 117 ---- .../mastodon/components/short_number.jsx | 117 ++++ app/javascript/mastodon/components/skeleton.js | 11 - app/javascript/mastodon/components/skeleton.jsx | 11 + app/javascript/mastodon/components/status.js | 547 ---------------- app/javascript/mastodon/components/status.jsx | 547 ++++++++++++++++ .../mastodon/components/status_action_bar.js | 387 ------------ .../mastodon/components/status_action_bar.jsx | 387 ++++++++++++ .../mastodon/components/status_content.js | 304 --------- .../mastodon/components/status_content.jsx | 304 +++++++++ app/javascript/mastodon/components/status_list.js | 131 ---- app/javascript/mastodon/components/status_list.jsx | 131 ++++ .../mastodon/components/timeline_hint.js | 18 - .../mastodon/components/timeline_hint.jsx | 18 + .../mastodon/containers/account_container.js | 72 --- .../mastodon/containers/account_container.jsx | 72 +++ .../mastodon/containers/admin_component.js | 26 - .../mastodon/containers/admin_component.jsx | 26 + .../mastodon/containers/compose_container.js | 41 -- .../mastodon/containers/compose_container.jsx | 41 ++ .../mastodon/containers/domain_container.js | 32 - .../mastodon/containers/domain_container.jsx | 32 + app/javascript/mastodon/containers/mastodon.js | 98 --- app/javascript/mastodon/containers/mastodon.jsx | 98 +++ .../mastodon/containers/media_container.js | 121 ---- .../mastodon/containers/media_container.jsx | 121 ++++ .../mastodon/containers/status_container.js | 250 -------- .../mastodon/containers/status_container.jsx | 250 ++++++++ app/javascript/mastodon/features/about/index.js | 219 ------- app/javascript/mastodon/features/about/index.jsx | 219 +++++++ .../features/account/components/account_note.js | 170 ----- .../features/account/components/account_note.jsx | 170 +++++ .../features/account/components/featured_tags.js | 52 -- .../features/account/components/featured_tags.jsx | 52 ++ .../account/components/follow_request_note.js | 37 -- .../account/components/follow_request_note.jsx | 37 ++ .../mastodon/features/account/components/header.js | 421 ------------- .../features/account/components/header.jsx | 421 +++++++++++++ .../mastodon/features/account/navigation.js | 52 -- .../mastodon/features/account/navigation.jsx | 52 ++ .../account_gallery/components/media_item.js | 146 ----- .../account_gallery/components/media_item.jsx | 146 +++++ .../mastodon/features/account_gallery/index.js | 228 ------- .../mastodon/features/account_gallery/index.jsx | 228 +++++++ .../features/account_timeline/components/header.js | 153 ----- .../account_timeline/components/header.jsx | 153 +++++ .../components/limited_account_hint.js | 36 -- .../components/limited_account_hint.jsx | 36 ++ .../account_timeline/components/moved_note.js | 37 -- .../account_timeline/components/moved_note.jsx | 37 ++ .../containers/header_container.js | 164 ----- .../containers/header_container.jsx | 164 +++++ .../mastodon/features/account_timeline/index.js | 208 ------- .../mastodon/features/account_timeline/index.jsx | 208 +++++++ app/javascript/mastodon/features/audio/index.js | 569 ----------------- app/javascript/mastodon/features/audio/index.jsx | 569 +++++++++++++++++ app/javascript/mastodon/features/blocks/index.js | 79 --- app/javascript/mastodon/features/blocks/index.jsx | 79 +++ .../mastodon/features/bookmarked_statuses/index.js | 108 ---- .../features/bookmarked_statuses/index.jsx | 108 ++++ .../features/closed_registrations_modal/index.js | 75 --- .../features/closed_registrations_modal/index.jsx | 75 +++ .../components/column_settings.js | 29 - .../components/column_settings.jsx | 29 + .../mastodon/features/community_timeline/index.js | 160 ----- .../mastodon/features/community_timeline/index.jsx | 160 +++++ .../features/compose/components/action_bar.js | 67 -- .../features/compose/components/action_bar.jsx | 67 ++ .../compose/components/autosuggest_account.js | 24 - .../compose/components/autosuggest_account.jsx | 24 + .../compose/components/character_counter.js | 25 - .../compose/components/character_counter.jsx | 25 + .../features/compose/components/compose_form.js | 301 --------- .../features/compose/components/compose_form.jsx | 301 +++++++++ .../compose/components/emoji_picker_dropdown.js | 411 ------------ .../compose/components/emoji_picker_dropdown.jsx | 411 ++++++++++++ .../compose/components/language_dropdown.js | 327 ---------- .../compose/components/language_dropdown.jsx | 327 ++++++++++ .../features/compose/components/navigation_bar.js | 43 -- .../features/compose/components/navigation_bar.jsx | 43 ++ .../features/compose/components/poll_button.js | 55 -- .../features/compose/components/poll_button.jsx | 55 ++ .../features/compose/components/poll_form.js | 182 ------ .../features/compose/components/poll_form.jsx | 182 ++++++ .../compose/components/privacy_dropdown.js | 287 --------- .../compose/components/privacy_dropdown.jsx | 287 +++++++++ .../features/compose/components/reply_indicator.js | 71 --- .../compose/components/reply_indicator.jsx | 71 +++ .../mastodon/features/compose/components/search.js | 147 ----- .../features/compose/components/search.jsx | 147 +++++ .../features/compose/components/search_results.js | 140 ----- .../features/compose/components/search_results.jsx | 140 +++++ .../compose/components/text_icon_button.js | 38 -- .../compose/components/text_icon_button.jsx | 38 ++ .../mastodon/features/compose/components/upload.js | 66 -- .../features/compose/components/upload.jsx | 66 ++ .../features/compose/components/upload_button.js | 83 --- .../features/compose/components/upload_button.jsx | 83 +++ .../features/compose/components/upload_form.js | 32 - .../features/compose/components/upload_form.jsx | 32 + .../features/compose/components/upload_progress.js | 52 -- .../compose/components/upload_progress.jsx | 52 ++ .../features/compose/components/warning.js | 26 - .../features/compose/components/warning.jsx | 26 + .../containers/sensitive_button_container.js | 71 --- .../containers/sensitive_button_container.jsx | 71 +++ .../compose/containers/warning_container.js | 67 -- .../compose/containers/warning_container.jsx | 67 ++ app/javascript/mastodon/features/compose/index.js | 150 ----- app/javascript/mastodon/features/compose/index.jsx | 150 +++++ .../direct_timeline/components/conversation.js | 200 ------ .../direct_timeline/components/conversation.jsx | 200 ++++++ .../components/conversations_list.js | 75 --- .../components/conversations_list.jsx | 75 +++ .../mastodon/features/direct_timeline/index.js | 107 ---- .../mastodon/features/direct_timeline/index.jsx | 107 ++++ .../features/directory/components/account_card.js | 235 ------- .../features/directory/components/account_card.jsx | 235 +++++++ .../mastodon/features/directory/index.js | 178 ------ .../mastodon/features/directory/index.jsx | 178 ++++++ .../mastodon/features/domain_blocks/index.js | 83 --- .../mastodon/features/domain_blocks/index.jsx | 83 +++ .../mastodon/features/explore/components/story.js | 51 -- .../mastodon/features/explore/components/story.jsx | 51 ++ app/javascript/mastodon/features/explore/index.js | 107 ---- app/javascript/mastodon/features/explore/index.jsx | 107 ++++ app/javascript/mastodon/features/explore/links.js | 70 --- app/javascript/mastodon/features/explore/links.jsx | 70 +++ .../mastodon/features/explore/results.js | 126 ---- .../mastodon/features/explore/results.jsx | 126 ++++ .../mastodon/features/explore/statuses.js | 64 -- .../mastodon/features/explore/statuses.jsx | 64 ++ .../mastodon/features/explore/suggestions.js | 51 -- .../mastodon/features/explore/suggestions.jsx | 51 ++ app/javascript/mastodon/features/explore/tags.js | 62 -- app/javascript/mastodon/features/explore/tags.jsx | 62 ++ .../mastodon/features/favourited_statuses/index.js | 108 ---- .../features/favourited_statuses/index.jsx | 108 ++++ .../mastodon/features/favourites/index.js | 92 --- .../mastodon/features/favourites/index.jsx | 92 +++ .../mastodon/features/filters/added_to_filter.js | 102 --- .../mastodon/features/filters/added_to_filter.jsx | 102 +++ .../mastodon/features/filters/select_filter.js | 192 ------ .../mastodon/features/filters/select_filter.jsx | 192 ++++++ .../follow_recommendations/components/account.js | 85 --- .../follow_recommendations/components/account.jsx | 85 +++ .../features/follow_recommendations/index.js | 116 ---- .../features/follow_recommendations/index.jsx | 116 ++++ .../components/account_authorize.js | 49 -- .../components/account_authorize.jsx | 49 ++ .../mastodon/features/follow_requests/index.js | 91 --- .../mastodon/features/follow_requests/index.jsx | 91 +++ .../mastodon/features/followed_tags/index.js | 89 --- .../mastodon/features/followed_tags/index.jsx | 89 +++ .../mastodon/features/followers/index.js | 170 ----- .../mastodon/features/followers/index.jsx | 170 +++++ .../mastodon/features/following/index.js | 170 ----- .../mastodon/features/following/index.jsx | 170 +++++ .../mastodon/features/generic_not_found/index.js | 11 - .../mastodon/features/generic_not_found/index.jsx | 11 + .../getting_started/components/announcements.js | 449 -------------- .../getting_started/components/announcements.jsx | 449 ++++++++++++++ .../features/getting_started/components/trends.js | 51 -- .../features/getting_started/components/trends.jsx | 51 ++ .../mastodon/features/getting_started/index.js | 155 ----- .../mastodon/features/getting_started/index.jsx | 155 +++++ .../hashtag_timeline/components/column_settings.js | 133 ---- .../components/column_settings.jsx | 133 ++++ .../mastodon/features/hashtag_timeline/index.js | 237 ------- .../mastodon/features/hashtag_timeline/index.jsx | 237 +++++++ .../home_timeline/components/column_settings.js | 34 - .../home_timeline/components/column_settings.jsx | 34 + .../mastodon/features/home_timeline/index.js | 176 ------ .../mastodon/features/home_timeline/index.jsx | 176 ++++++ .../mastodon/features/interaction_modal/index.js | 161 ----- .../mastodon/features/interaction_modal/index.jsx | 161 +++++ .../mastodon/features/keyboard_shortcuts/index.js | 176 ------ .../mastodon/features/keyboard_shortcuts/index.jsx | 176 ++++++ .../features/list_adder/components/account.js | 43 -- .../features/list_adder/components/account.jsx | 43 ++ .../features/list_adder/components/list.js | 69 --- .../features/list_adder/components/list.jsx | 69 +++ .../mastodon/features/list_adder/index.js | 73 --- .../mastodon/features/list_adder/index.jsx | 73 +++ .../features/list_editor/components/account.js | 77 --- .../features/list_editor/components/account.jsx | 77 +++ .../list_editor/components/edit_list_form.js | 70 --- .../list_editor/components/edit_list_form.jsx | 70 +++ .../features/list_editor/components/search.js | 76 --- .../features/list_editor/components/search.jsx | 76 +++ .../mastodon/features/list_editor/index.js | 79 --- .../mastodon/features/list_editor/index.jsx | 79 +++ .../mastodon/features/list_timeline/index.js | 221 ------- .../mastodon/features/list_timeline/index.jsx | 221 +++++++ .../features/lists/components/new_list_form.js | 77 --- .../features/lists/components/new_list_form.jsx | 77 +++ app/javascript/mastodon/features/lists/index.js | 89 --- app/javascript/mastodon/features/lists/index.jsx | 89 +++ app/javascript/mastodon/features/mutes/index.js | 84 --- app/javascript/mastodon/features/mutes/index.jsx | 84 +++ .../components/clear_column_button.js | 18 - .../components/clear_column_button.jsx | 18 + .../notifications/components/column_settings.js | 202 ------ .../notifications/components/column_settings.jsx | 202 ++++++ .../notifications/components/filter_bar.js | 110 ---- .../notifications/components/filter_bar.jsx | 110 ++++ .../notifications/components/follow_request.js | 59 -- .../notifications/components/follow_request.jsx | 59 ++ .../components/grant_permission_button.js | 19 - .../components/grant_permission_button.jsx | 19 + .../notifications/components/notification.js | 449 -------------- .../notifications/components/notification.jsx | 449 ++++++++++++++ .../components/notifications_permission_banner.js | 48 -- .../components/notifications_permission_banner.jsx | 48 ++ .../features/notifications/components/report.js | 62 -- .../features/notifications/components/report.jsx | 62 ++ .../notifications/components/setting_toggle.js | 34 - .../notifications/components/setting_toggle.jsx | 34 + .../mastodon/features/notifications/index.js | 290 --------- .../mastodon/features/notifications/index.jsx | 290 +++++++++ .../picture_in_picture/components/footer.js | 192 ------ .../picture_in_picture/components/footer.jsx | 192 ++++++ .../picture_in_picture/components/header.js | 47 -- .../picture_in_picture/components/header.jsx | 47 ++ .../mastodon/features/picture_in_picture/index.js | 85 --- .../mastodon/features/picture_in_picture/index.jsx | 85 +++ .../mastodon/features/pinned_statuses/index.js | 65 -- .../mastodon/features/pinned_statuses/index.jsx | 65 ++ .../mastodon/features/privacy_policy/index.js | 61 -- .../mastodon/features/privacy_policy/index.jsx | 61 ++ .../public_timeline/components/column_settings.js | 30 - .../public_timeline/components/column_settings.jsx | 30 + .../mastodon/features/public_timeline/index.js | 162 ----- .../mastodon/features/public_timeline/index.jsx | 162 +++++ app/javascript/mastodon/features/reblogs/index.js | 92 --- app/javascript/mastodon/features/reblogs/index.jsx | 92 +++ .../mastodon/features/report/category.js | 106 ---- .../mastodon/features/report/category.jsx | 106 ++++ app/javascript/mastodon/features/report/comment.js | 83 --- .../mastodon/features/report/comment.jsx | 83 +++ .../mastodon/features/report/components/option.js | 60 -- .../mastodon/features/report/components/option.jsx | 60 ++ .../features/report/components/status_check_box.js | 82 --- .../report/components/status_check_box.jsx | 82 +++ app/javascript/mastodon/features/report/rules.js | 64 -- app/javascript/mastodon/features/report/rules.jsx | 64 ++ .../mastodon/features/report/statuses.js | 61 -- .../mastodon/features/report/statuses.jsx | 61 ++ app/javascript/mastodon/features/report/thanks.js | 84 --- app/javascript/mastodon/features/report/thanks.jsx | 84 +++ .../mastodon/features/standalone/compose/index.js | 20 - .../mastodon/features/standalone/compose/index.jsx | 20 + .../features/status/components/action_bar.js | 300 --------- .../features/status/components/action_bar.jsx | 300 +++++++++ .../mastodon/features/status/components/card.js | 289 --------- .../mastodon/features/status/components/card.jsx | 289 +++++++++ .../features/status/components/detailed_status.js | 288 --------- .../features/status/components/detailed_status.jsx | 288 +++++++++ app/javascript/mastodon/features/status/index.js | 686 --------------------- app/javascript/mastodon/features/status/index.jsx | 686 +++++++++++++++++++++ .../features/subscribed_languages_modal/index.js | 125 ---- .../features/subscribed_languages_modal/index.jsx | 125 ++++ .../ui/components/__tests__/column-test.js | 24 - .../ui/components/__tests__/column-test.jsx | 24 + .../features/ui/components/actions_modal.js | 46 -- .../features/ui/components/actions_modal.jsx | 46 ++ .../mastodon/features/ui/components/audio_modal.js | 54 -- .../features/ui/components/audio_modal.jsx | 54 ++ .../mastodon/features/ui/components/block_modal.js | 103 ---- .../features/ui/components/block_modal.jsx | 103 ++++ .../mastodon/features/ui/components/boost_modal.js | 142 ----- .../features/ui/components/boost_modal.jsx | 142 +++++ .../mastodon/features/ui/components/bundle.js | 106 ---- .../mastodon/features/ui/components/bundle.jsx | 106 ++++ .../features/ui/components/bundle_column_error.js | 162 ----- .../features/ui/components/bundle_column_error.jsx | 162 +++++ .../features/ui/components/bundle_modal_error.js | 53 -- .../features/ui/components/bundle_modal_error.jsx | 53 ++ .../mastodon/features/ui/components/column.js | 72 --- .../mastodon/features/ui/components/column.jsx | 72 +++ .../features/ui/components/column_header.js | 38 -- .../features/ui/components/column_header.jsx | 38 ++ .../mastodon/features/ui/components/column_link.js | 41 -- .../features/ui/components/column_link.jsx | 41 ++ .../features/ui/components/column_loading.js | 32 - .../features/ui/components/column_loading.jsx | 32 + .../features/ui/components/column_subheading.js | 16 - .../features/ui/components/column_subheading.jsx | 16 + .../features/ui/components/columns_area.js | 181 ------ .../features/ui/components/columns_area.jsx | 181 ++++++ .../ui/components/compare_history_modal.js | 99 --- .../ui/components/compare_history_modal.jsx | 99 +++ .../features/ui/components/compose_panel.js | 68 -- .../features/ui/components/compose_panel.jsx | 68 ++ .../features/ui/components/confirmation_modal.js | 70 --- .../features/ui/components/confirmation_modal.jsx | 70 +++ .../ui/components/disabled_account_banner.js | 92 --- .../ui/components/disabled_account_banner.jsx | 92 +++ .../features/ui/components/drawer_loading.js | 11 - .../features/ui/components/drawer_loading.jsx | 11 + .../mastodon/features/ui/components/embed_modal.js | 97 --- .../features/ui/components/embed_modal.jsx | 97 +++ .../features/ui/components/filter_modal.js | 134 ---- .../features/ui/components/filter_modal.jsx | 134 ++++ .../features/ui/components/focal_point_modal.js | 430 ------------- .../features/ui/components/focal_point_modal.jsx | 430 +++++++++++++ .../ui/components/follow_requests_column_link.js | 51 -- .../ui/components/follow_requests_column_link.jsx | 51 ++ .../mastodon/features/ui/components/header.js | 87 --- .../mastodon/features/ui/components/header.jsx | 87 +++ .../features/ui/components/image_loader.js | 168 ----- .../features/ui/components/image_loader.jsx | 168 +++++ .../mastodon/features/ui/components/image_modal.js | 59 -- .../features/ui/components/image_modal.jsx | 59 ++ .../mastodon/features/ui/components/link_footer.js | 102 --- .../features/ui/components/link_footer.jsx | 102 +++ .../mastodon/features/ui/components/list_panel.js | 55 -- .../mastodon/features/ui/components/list_panel.jsx | 55 ++ .../mastodon/features/ui/components/media_modal.js | 250 -------- .../features/ui/components/media_modal.jsx | 250 ++++++++ .../features/ui/components/modal_loading.js | 20 - .../features/ui/components/modal_loading.jsx | 20 + .../mastodon/features/ui/components/modal_root.js | 133 ---- .../mastodon/features/ui/components/modal_root.jsx | 133 ++++ .../mastodon/features/ui/components/mute_modal.js | 140 ----- .../mastodon/features/ui/components/mute_modal.jsx | 140 +++++ .../features/ui/components/navigation_panel.js | 107 ---- .../features/ui/components/navigation_panel.jsx | 107 ++++ .../features/ui/components/report_modal.js | 219 ------- .../features/ui/components/report_modal.jsx | 219 +++++++ .../features/ui/components/sign_in_banner.js | 40 -- .../features/ui/components/sign_in_banner.jsx | 40 ++ .../mastodon/features/ui/components/upload_area.js | 52 -- .../features/ui/components/upload_area.jsx | 52 ++ .../mastodon/features/ui/components/video_modal.js | 62 -- .../features/ui/components/video_modal.jsx | 62 ++ .../features/ui/components/zoomable_image.js | 450 -------------- .../features/ui/components/zoomable_image.jsx | 450 ++++++++++++++ app/javascript/mastodon/features/ui/index.js | 589 ------------------ app/javascript/mastodon/features/ui/index.jsx | 589 ++++++++++++++++++ .../features/ui/util/react_router_helpers.js | 101 --- .../features/ui/util/react_router_helpers.jsx | 101 +++ .../mastodon/features/ui/util/reduced_motion.js | 44 -- .../mastodon/features/ui/util/reduced_motion.jsx | 44 ++ app/javascript/mastodon/features/video/index.js | 655 -------------------- app/javascript/mastodon/features/video/index.jsx | 655 ++++++++++++++++++++ app/javascript/mastodon/main.js | 46 -- app/javascript/mastodon/main.jsx | 46 ++ app/javascript/mastodon/utils/icons.js | 15 - app/javascript/mastodon/utils/icons.jsx | 15 + app/javascript/packs/admin.js | 245 -------- app/javascript/packs/admin.jsx | 245 ++++++++ app/javascript/packs/public.js | 332 ---------- app/javascript/packs/public.jsx | 332 ++++++++++ app/javascript/packs/share.js | 26 - app/javascript/packs/share.jsx | 26 + config/webpacker.yml | 1 + package.json | 2 +- 491 files changed, 29087 insertions(+), 29079 deletions(-) delete mode 100644 app/javascript/mastodon/components/__tests__/__snapshots__/autosuggest_emoji-test.js.snap create mode 100644 app/javascript/mastodon/components/__tests__/__snapshots__/autosuggest_emoji-test.jsx.snap delete mode 100644 app/javascript/mastodon/components/__tests__/__snapshots__/avatar-test.js.snap create mode 100644 app/javascript/mastodon/components/__tests__/__snapshots__/avatar-test.jsx.snap delete mode 100644 app/javascript/mastodon/components/__tests__/__snapshots__/avatar_overlay-test.js.snap create mode 100644 app/javascript/mastodon/components/__tests__/__snapshots__/avatar_overlay-test.jsx.snap delete mode 100644 app/javascript/mastodon/components/__tests__/__snapshots__/button-test.js.snap create mode 100644 app/javascript/mastodon/components/__tests__/__snapshots__/button-test.jsx.snap delete mode 100644 app/javascript/mastodon/components/__tests__/__snapshots__/display_name-test.js.snap create mode 100644 app/javascript/mastodon/components/__tests__/__snapshots__/display_name-test.jsx.snap delete mode 100644 app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.js create mode 100644 app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.jsx delete mode 100644 app/javascript/mastodon/components/__tests__/avatar-test.js create mode 100644 app/javascript/mastodon/components/__tests__/avatar-test.jsx delete mode 100644 app/javascript/mastodon/components/__tests__/avatar_overlay-test.js create mode 100644 app/javascript/mastodon/components/__tests__/avatar_overlay-test.jsx delete mode 100644 app/javascript/mastodon/components/__tests__/button-test.js create mode 100644 app/javascript/mastodon/components/__tests__/button-test.jsx delete mode 100644 app/javascript/mastodon/components/__tests__/display_name-test.js create mode 100644 app/javascript/mastodon/components/__tests__/display_name-test.jsx delete mode 100644 app/javascript/mastodon/components/account.js create mode 100644 app/javascript/mastodon/components/account.jsx delete mode 100644 app/javascript/mastodon/components/admin/Counter.js create mode 100644 app/javascript/mastodon/components/admin/Counter.jsx delete mode 100644 app/javascript/mastodon/components/admin/Dimension.js create mode 100644 app/javascript/mastodon/components/admin/Dimension.jsx delete mode 100644 app/javascript/mastodon/components/admin/ReportReasonSelector.js create mode 100644 app/javascript/mastodon/components/admin/ReportReasonSelector.jsx delete mode 100644 app/javascript/mastodon/components/admin/Retention.js create mode 100644 app/javascript/mastodon/components/admin/Retention.jsx delete mode 100644 app/javascript/mastodon/components/admin/Trends.js create mode 100644 app/javascript/mastodon/components/admin/Trends.jsx delete mode 100644 app/javascript/mastodon/components/animated_number.js create mode 100644 app/javascript/mastodon/components/animated_number.jsx delete mode 100644 app/javascript/mastodon/components/attachment_list.js create mode 100644 app/javascript/mastodon/components/attachment_list.jsx delete mode 100644 app/javascript/mastodon/components/autosuggest_emoji.js create mode 100644 app/javascript/mastodon/components/autosuggest_emoji.jsx delete mode 100644 app/javascript/mastodon/components/autosuggest_hashtag.js create mode 100644 app/javascript/mastodon/components/autosuggest_hashtag.jsx delete mode 100644 app/javascript/mastodon/components/autosuggest_input.js create mode 100644 app/javascript/mastodon/components/autosuggest_input.jsx delete mode 100644 app/javascript/mastodon/components/autosuggest_textarea.js create mode 100644 app/javascript/mastodon/components/autosuggest_textarea.jsx delete mode 100644 app/javascript/mastodon/components/avatar.js create mode 100644 app/javascript/mastodon/components/avatar.jsx delete mode 100644 app/javascript/mastodon/components/avatar_composite.js create mode 100644 app/javascript/mastodon/components/avatar_composite.jsx delete mode 100644 app/javascript/mastodon/components/avatar_overlay.js create mode 100644 app/javascript/mastodon/components/avatar_overlay.jsx delete mode 100644 app/javascript/mastodon/components/blurhash.js create mode 100644 app/javascript/mastodon/components/blurhash.jsx delete mode 100644 app/javascript/mastodon/components/button.js create mode 100644 app/javascript/mastodon/components/button.jsx delete mode 100644 app/javascript/mastodon/components/check.js create mode 100644 app/javascript/mastodon/components/check.jsx delete mode 100644 app/javascript/mastodon/components/column.js create mode 100644 app/javascript/mastodon/components/column.jsx delete mode 100644 app/javascript/mastodon/components/column_back_button.js create mode 100644 app/javascript/mastodon/components/column_back_button.jsx delete mode 100644 app/javascript/mastodon/components/column_back_button_slim.js create mode 100644 app/javascript/mastodon/components/column_back_button_slim.jsx delete mode 100644 app/javascript/mastodon/components/column_header.js create mode 100644 app/javascript/mastodon/components/column_header.jsx delete mode 100644 app/javascript/mastodon/components/common_counter.js create mode 100644 app/javascript/mastodon/components/common_counter.jsx delete mode 100644 app/javascript/mastodon/components/dismissable_banner.js create mode 100644 app/javascript/mastodon/components/dismissable_banner.jsx delete mode 100644 app/javascript/mastodon/components/display_name.js create mode 100644 app/javascript/mastodon/components/display_name.jsx delete mode 100644 app/javascript/mastodon/components/domain.js create mode 100644 app/javascript/mastodon/components/domain.jsx delete mode 100644 app/javascript/mastodon/components/dropdown_menu.js create mode 100644 app/javascript/mastodon/components/dropdown_menu.jsx delete mode 100644 app/javascript/mastodon/components/edited_timestamp/index.js create mode 100644 app/javascript/mastodon/components/edited_timestamp/index.jsx delete mode 100644 app/javascript/mastodon/components/error_boundary.js create mode 100644 app/javascript/mastodon/components/error_boundary.jsx delete mode 100644 app/javascript/mastodon/components/gifv.js create mode 100644 app/javascript/mastodon/components/gifv.jsx delete mode 100644 app/javascript/mastodon/components/hashtag.js create mode 100644 app/javascript/mastodon/components/hashtag.jsx delete mode 100644 app/javascript/mastodon/components/icon.js create mode 100644 app/javascript/mastodon/components/icon.jsx delete mode 100644 app/javascript/mastodon/components/icon_button.js create mode 100644 app/javascript/mastodon/components/icon_button.jsx delete mode 100644 app/javascript/mastodon/components/icon_with_badge.js create mode 100644 app/javascript/mastodon/components/icon_with_badge.jsx delete mode 100644 app/javascript/mastodon/components/image.js create mode 100644 app/javascript/mastodon/components/image.jsx delete mode 100644 app/javascript/mastodon/components/inline_account.js create mode 100644 app/javascript/mastodon/components/inline_account.jsx delete mode 100644 app/javascript/mastodon/components/intersection_observer_article.js create mode 100644 app/javascript/mastodon/components/intersection_observer_article.jsx delete mode 100644 app/javascript/mastodon/components/load_gap.js create mode 100644 app/javascript/mastodon/components/load_gap.jsx delete mode 100644 app/javascript/mastodon/components/load_more.js create mode 100644 app/javascript/mastodon/components/load_more.jsx delete mode 100644 app/javascript/mastodon/components/load_pending.js create mode 100644 app/javascript/mastodon/components/load_pending.jsx delete mode 100644 app/javascript/mastodon/components/loading_indicator.js create mode 100644 app/javascript/mastodon/components/loading_indicator.jsx delete mode 100644 app/javascript/mastodon/components/logo.js create mode 100644 app/javascript/mastodon/components/logo.jsx delete mode 100644 app/javascript/mastodon/components/media_attachments.js create mode 100644 app/javascript/mastodon/components/media_attachments.jsx delete mode 100644 app/javascript/mastodon/components/media_gallery.js create mode 100644 app/javascript/mastodon/components/media_gallery.jsx delete mode 100644 app/javascript/mastodon/components/missing_indicator.js create mode 100644 app/javascript/mastodon/components/missing_indicator.jsx delete mode 100644 app/javascript/mastodon/components/modal_root.js create mode 100644 app/javascript/mastodon/components/modal_root.jsx delete mode 100644 app/javascript/mastodon/components/navigation_portal.js create mode 100644 app/javascript/mastodon/components/navigation_portal.jsx delete mode 100644 app/javascript/mastodon/components/not_signed_in_indicator.js create mode 100644 app/javascript/mastodon/components/not_signed_in_indicator.jsx delete mode 100644 app/javascript/mastodon/components/picture_in_picture_placeholder.js create mode 100644 app/javascript/mastodon/components/picture_in_picture_placeholder.jsx delete mode 100644 app/javascript/mastodon/components/poll.js create mode 100644 app/javascript/mastodon/components/poll.jsx delete mode 100644 app/javascript/mastodon/components/radio_button.js create mode 100644 app/javascript/mastodon/components/radio_button.jsx delete mode 100644 app/javascript/mastodon/components/regeneration_indicator.js create mode 100644 app/javascript/mastodon/components/regeneration_indicator.jsx delete mode 100644 app/javascript/mastodon/components/relative_timestamp.js create mode 100644 app/javascript/mastodon/components/relative_timestamp.jsx delete mode 100644 app/javascript/mastodon/components/scrollable_list.js create mode 100644 app/javascript/mastodon/components/scrollable_list.jsx delete mode 100644 app/javascript/mastodon/components/server_banner.js create mode 100644 app/javascript/mastodon/components/server_banner.jsx delete mode 100644 app/javascript/mastodon/components/short_number.js create mode 100644 app/javascript/mastodon/components/short_number.jsx delete mode 100644 app/javascript/mastodon/components/skeleton.js create mode 100644 app/javascript/mastodon/components/skeleton.jsx delete mode 100644 app/javascript/mastodon/components/status.js create mode 100644 app/javascript/mastodon/components/status.jsx delete mode 100644 app/javascript/mastodon/components/status_action_bar.js create mode 100644 app/javascript/mastodon/components/status_action_bar.jsx delete mode 100644 app/javascript/mastodon/components/status_content.js create mode 100644 app/javascript/mastodon/components/status_content.jsx delete mode 100644 app/javascript/mastodon/components/status_list.js create mode 100644 app/javascript/mastodon/components/status_list.jsx delete mode 100644 app/javascript/mastodon/components/timeline_hint.js create mode 100644 app/javascript/mastodon/components/timeline_hint.jsx delete mode 100644 app/javascript/mastodon/containers/account_container.js create mode 100644 app/javascript/mastodon/containers/account_container.jsx delete mode 100644 app/javascript/mastodon/containers/admin_component.js create mode 100644 app/javascript/mastodon/containers/admin_component.jsx delete mode 100644 app/javascript/mastodon/containers/compose_container.js create mode 100644 app/javascript/mastodon/containers/compose_container.jsx delete mode 100644 app/javascript/mastodon/containers/domain_container.js create mode 100644 app/javascript/mastodon/containers/domain_container.jsx delete mode 100644 app/javascript/mastodon/containers/mastodon.js create mode 100644 app/javascript/mastodon/containers/mastodon.jsx delete mode 100644 app/javascript/mastodon/containers/media_container.js create mode 100644 app/javascript/mastodon/containers/media_container.jsx delete mode 100644 app/javascript/mastodon/containers/status_container.js create mode 100644 app/javascript/mastodon/containers/status_container.jsx delete mode 100644 app/javascript/mastodon/features/about/index.js create mode 100644 app/javascript/mastodon/features/about/index.jsx delete mode 100644 app/javascript/mastodon/features/account/components/account_note.js create mode 100644 app/javascript/mastodon/features/account/components/account_note.jsx delete mode 100644 app/javascript/mastodon/features/account/components/featured_tags.js create mode 100644 app/javascript/mastodon/features/account/components/featured_tags.jsx delete mode 100644 app/javascript/mastodon/features/account/components/follow_request_note.js create mode 100644 app/javascript/mastodon/features/account/components/follow_request_note.jsx delete mode 100644 app/javascript/mastodon/features/account/components/header.js create mode 100644 app/javascript/mastodon/features/account/components/header.jsx delete mode 100644 app/javascript/mastodon/features/account/navigation.js create mode 100644 app/javascript/mastodon/features/account/navigation.jsx delete mode 100644 app/javascript/mastodon/features/account_gallery/components/media_item.js create mode 100644 app/javascript/mastodon/features/account_gallery/components/media_item.jsx delete mode 100644 app/javascript/mastodon/features/account_gallery/index.js create mode 100644 app/javascript/mastodon/features/account_gallery/index.jsx delete mode 100644 app/javascript/mastodon/features/account_timeline/components/header.js create mode 100644 app/javascript/mastodon/features/account_timeline/components/header.jsx delete mode 100644 app/javascript/mastodon/features/account_timeline/components/limited_account_hint.js create mode 100644 app/javascript/mastodon/features/account_timeline/components/limited_account_hint.jsx delete mode 100644 app/javascript/mastodon/features/account_timeline/components/moved_note.js create mode 100644 app/javascript/mastodon/features/account_timeline/components/moved_note.jsx delete mode 100644 app/javascript/mastodon/features/account_timeline/containers/header_container.js create mode 100644 app/javascript/mastodon/features/account_timeline/containers/header_container.jsx delete mode 100644 app/javascript/mastodon/features/account_timeline/index.js create mode 100644 app/javascript/mastodon/features/account_timeline/index.jsx delete mode 100644 app/javascript/mastodon/features/audio/index.js create mode 100644 app/javascript/mastodon/features/audio/index.jsx delete mode 100644 app/javascript/mastodon/features/blocks/index.js create mode 100644 app/javascript/mastodon/features/blocks/index.jsx delete mode 100644 app/javascript/mastodon/features/bookmarked_statuses/index.js create mode 100644 app/javascript/mastodon/features/bookmarked_statuses/index.jsx delete mode 100644 app/javascript/mastodon/features/closed_registrations_modal/index.js create mode 100644 app/javascript/mastodon/features/closed_registrations_modal/index.jsx delete mode 100644 app/javascript/mastodon/features/community_timeline/components/column_settings.js create mode 100644 app/javascript/mastodon/features/community_timeline/components/column_settings.jsx delete mode 100644 app/javascript/mastodon/features/community_timeline/index.js create mode 100644 app/javascript/mastodon/features/community_timeline/index.jsx delete mode 100644 app/javascript/mastodon/features/compose/components/action_bar.js create mode 100644 app/javascript/mastodon/features/compose/components/action_bar.jsx delete mode 100644 app/javascript/mastodon/features/compose/components/autosuggest_account.js create mode 100644 app/javascript/mastodon/features/compose/components/autosuggest_account.jsx delete mode 100644 app/javascript/mastodon/features/compose/components/character_counter.js create mode 100644 app/javascript/mastodon/features/compose/components/character_counter.jsx delete mode 100644 app/javascript/mastodon/features/compose/components/compose_form.js create mode 100644 app/javascript/mastodon/features/compose/components/compose_form.jsx delete mode 100644 app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js create mode 100644 app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.jsx delete mode 100644 app/javascript/mastodon/features/compose/components/language_dropdown.js create mode 100644 app/javascript/mastodon/features/compose/components/language_dropdown.jsx delete mode 100644 app/javascript/mastodon/features/compose/components/navigation_bar.js create mode 100644 app/javascript/mastodon/features/compose/components/navigation_bar.jsx delete mode 100644 app/javascript/mastodon/features/compose/components/poll_button.js create mode 100644 app/javascript/mastodon/features/compose/components/poll_button.jsx delete mode 100644 app/javascript/mastodon/features/compose/components/poll_form.js create mode 100644 app/javascript/mastodon/features/compose/components/poll_form.jsx delete mode 100644 app/javascript/mastodon/features/compose/components/privacy_dropdown.js create mode 100644 app/javascript/mastodon/features/compose/components/privacy_dropdown.jsx delete mode 100644 app/javascript/mastodon/features/compose/components/reply_indicator.js create mode 100644 app/javascript/mastodon/features/compose/components/reply_indicator.jsx delete mode 100644 app/javascript/mastodon/features/compose/components/search.js create mode 100644 app/javascript/mastodon/features/compose/components/search.jsx delete mode 100644 app/javascript/mastodon/features/compose/components/search_results.js create mode 100644 app/javascript/mastodon/features/compose/components/search_results.jsx delete mode 100644 app/javascript/mastodon/features/compose/components/text_icon_button.js create mode 100644 app/javascript/mastodon/features/compose/components/text_icon_button.jsx delete mode 100644 app/javascript/mastodon/features/compose/components/upload.js create mode 100644 app/javascript/mastodon/features/compose/components/upload.jsx delete mode 100644 app/javascript/mastodon/features/compose/components/upload_button.js create mode 100644 app/javascript/mastodon/features/compose/components/upload_button.jsx delete mode 100644 app/javascript/mastodon/features/compose/components/upload_form.js create mode 100644 app/javascript/mastodon/features/compose/components/upload_form.jsx delete mode 100644 app/javascript/mastodon/features/compose/components/upload_progress.js create mode 100644 app/javascript/mastodon/features/compose/components/upload_progress.jsx delete mode 100644 app/javascript/mastodon/features/compose/components/warning.js create mode 100644 app/javascript/mastodon/features/compose/components/warning.jsx delete mode 100644 app/javascript/mastodon/features/compose/containers/sensitive_button_container.js create mode 100644 app/javascript/mastodon/features/compose/containers/sensitive_button_container.jsx delete mode 100644 app/javascript/mastodon/features/compose/containers/warning_container.js create mode 100644 app/javascript/mastodon/features/compose/containers/warning_container.jsx delete mode 100644 app/javascript/mastodon/features/compose/index.js create mode 100644 app/javascript/mastodon/features/compose/index.jsx delete mode 100644 app/javascript/mastodon/features/direct_timeline/components/conversation.js create mode 100644 app/javascript/mastodon/features/direct_timeline/components/conversation.jsx delete mode 100644 app/javascript/mastodon/features/direct_timeline/components/conversations_list.js create mode 100644 app/javascript/mastodon/features/direct_timeline/components/conversations_list.jsx delete mode 100644 app/javascript/mastodon/features/direct_timeline/index.js create mode 100644 app/javascript/mastodon/features/direct_timeline/index.jsx delete mode 100644 app/javascript/mastodon/features/directory/components/account_card.js create mode 100644 app/javascript/mastodon/features/directory/components/account_card.jsx delete mode 100644 app/javascript/mastodon/features/directory/index.js create mode 100644 app/javascript/mastodon/features/directory/index.jsx delete mode 100644 app/javascript/mastodon/features/domain_blocks/index.js create mode 100644 app/javascript/mastodon/features/domain_blocks/index.jsx delete mode 100644 app/javascript/mastodon/features/explore/components/story.js create mode 100644 app/javascript/mastodon/features/explore/components/story.jsx delete mode 100644 app/javascript/mastodon/features/explore/index.js create mode 100644 app/javascript/mastodon/features/explore/index.jsx delete mode 100644 app/javascript/mastodon/features/explore/links.js create mode 100644 app/javascript/mastodon/features/explore/links.jsx delete mode 100644 app/javascript/mastodon/features/explore/results.js create mode 100644 app/javascript/mastodon/features/explore/results.jsx delete mode 100644 app/javascript/mastodon/features/explore/statuses.js create mode 100644 app/javascript/mastodon/features/explore/statuses.jsx delete mode 100644 app/javascript/mastodon/features/explore/suggestions.js create mode 100644 app/javascript/mastodon/features/explore/suggestions.jsx delete mode 100644 app/javascript/mastodon/features/explore/tags.js create mode 100644 app/javascript/mastodon/features/explore/tags.jsx delete mode 100644 app/javascript/mastodon/features/favourited_statuses/index.js create mode 100644 app/javascript/mastodon/features/favourited_statuses/index.jsx delete mode 100644 app/javascript/mastodon/features/favourites/index.js create mode 100644 app/javascript/mastodon/features/favourites/index.jsx delete mode 100644 app/javascript/mastodon/features/filters/added_to_filter.js create mode 100644 app/javascript/mastodon/features/filters/added_to_filter.jsx delete mode 100644 app/javascript/mastodon/features/filters/select_filter.js create mode 100644 app/javascript/mastodon/features/filters/select_filter.jsx delete mode 100644 app/javascript/mastodon/features/follow_recommendations/components/account.js create mode 100644 app/javascript/mastodon/features/follow_recommendations/components/account.jsx delete mode 100644 app/javascript/mastodon/features/follow_recommendations/index.js create mode 100644 app/javascript/mastodon/features/follow_recommendations/index.jsx delete mode 100644 app/javascript/mastodon/features/follow_requests/components/account_authorize.js create mode 100644 app/javascript/mastodon/features/follow_requests/components/account_authorize.jsx delete mode 100644 app/javascript/mastodon/features/follow_requests/index.js create mode 100644 app/javascript/mastodon/features/follow_requests/index.jsx delete mode 100644 app/javascript/mastodon/features/followed_tags/index.js create mode 100644 app/javascript/mastodon/features/followed_tags/index.jsx delete mode 100644 app/javascript/mastodon/features/followers/index.js create mode 100644 app/javascript/mastodon/features/followers/index.jsx delete mode 100644 app/javascript/mastodon/features/following/index.js create mode 100644 app/javascript/mastodon/features/following/index.jsx delete mode 100644 app/javascript/mastodon/features/generic_not_found/index.js create mode 100644 app/javascript/mastodon/features/generic_not_found/index.jsx delete mode 100644 app/javascript/mastodon/features/getting_started/components/announcements.js create mode 100644 app/javascript/mastodon/features/getting_started/components/announcements.jsx delete mode 100644 app/javascript/mastodon/features/getting_started/components/trends.js create mode 100644 app/javascript/mastodon/features/getting_started/components/trends.jsx delete mode 100644 app/javascript/mastodon/features/getting_started/index.js create mode 100644 app/javascript/mastodon/features/getting_started/index.jsx delete mode 100644 app/javascript/mastodon/features/hashtag_timeline/components/column_settings.js create mode 100644 app/javascript/mastodon/features/hashtag_timeline/components/column_settings.jsx delete mode 100644 app/javascript/mastodon/features/hashtag_timeline/index.js create mode 100644 app/javascript/mastodon/features/hashtag_timeline/index.jsx delete mode 100644 app/javascript/mastodon/features/home_timeline/components/column_settings.js create mode 100644 app/javascript/mastodon/features/home_timeline/components/column_settings.jsx delete mode 100644 app/javascript/mastodon/features/home_timeline/index.js create mode 100644 app/javascript/mastodon/features/home_timeline/index.jsx delete mode 100644 app/javascript/mastodon/features/interaction_modal/index.js create mode 100644 app/javascript/mastodon/features/interaction_modal/index.jsx delete mode 100644 app/javascript/mastodon/features/keyboard_shortcuts/index.js create mode 100644 app/javascript/mastodon/features/keyboard_shortcuts/index.jsx delete mode 100644 app/javascript/mastodon/features/list_adder/components/account.js create mode 100644 app/javascript/mastodon/features/list_adder/components/account.jsx delete mode 100644 app/javascript/mastodon/features/list_adder/components/list.js create mode 100644 app/javascript/mastodon/features/list_adder/components/list.jsx delete mode 100644 app/javascript/mastodon/features/list_adder/index.js create mode 100644 app/javascript/mastodon/features/list_adder/index.jsx delete mode 100644 app/javascript/mastodon/features/list_editor/components/account.js create mode 100644 app/javascript/mastodon/features/list_editor/components/account.jsx delete mode 100644 app/javascript/mastodon/features/list_editor/components/edit_list_form.js create mode 100644 app/javascript/mastodon/features/list_editor/components/edit_list_form.jsx delete mode 100644 app/javascript/mastodon/features/list_editor/components/search.js create mode 100644 app/javascript/mastodon/features/list_editor/components/search.jsx delete mode 100644 app/javascript/mastodon/features/list_editor/index.js create mode 100644 app/javascript/mastodon/features/list_editor/index.jsx delete mode 100644 app/javascript/mastodon/features/list_timeline/index.js create mode 100644 app/javascript/mastodon/features/list_timeline/index.jsx delete mode 100644 app/javascript/mastodon/features/lists/components/new_list_form.js create mode 100644 app/javascript/mastodon/features/lists/components/new_list_form.jsx delete mode 100644 app/javascript/mastodon/features/lists/index.js create mode 100644 app/javascript/mastodon/features/lists/index.jsx delete mode 100644 app/javascript/mastodon/features/mutes/index.js create mode 100644 app/javascript/mastodon/features/mutes/index.jsx delete mode 100644 app/javascript/mastodon/features/notifications/components/clear_column_button.js create mode 100644 app/javascript/mastodon/features/notifications/components/clear_column_button.jsx delete mode 100644 app/javascript/mastodon/features/notifications/components/column_settings.js create mode 100644 app/javascript/mastodon/features/notifications/components/column_settings.jsx delete mode 100644 app/javascript/mastodon/features/notifications/components/filter_bar.js create mode 100644 app/javascript/mastodon/features/notifications/components/filter_bar.jsx delete mode 100644 app/javascript/mastodon/features/notifications/components/follow_request.js create mode 100644 app/javascript/mastodon/features/notifications/components/follow_request.jsx delete mode 100644 app/javascript/mastodon/features/notifications/components/grant_permission_button.js create mode 100644 app/javascript/mastodon/features/notifications/components/grant_permission_button.jsx delete mode 100644 app/javascript/mastodon/features/notifications/components/notification.js create mode 100644 app/javascript/mastodon/features/notifications/components/notification.jsx delete mode 100644 app/javascript/mastodon/features/notifications/components/notifications_permission_banner.js create mode 100644 app/javascript/mastodon/features/notifications/components/notifications_permission_banner.jsx delete mode 100644 app/javascript/mastodon/features/notifications/components/report.js create mode 100644 app/javascript/mastodon/features/notifications/components/report.jsx delete mode 100644 app/javascript/mastodon/features/notifications/components/setting_toggle.js create mode 100644 app/javascript/mastodon/features/notifications/components/setting_toggle.jsx delete mode 100644 app/javascript/mastodon/features/notifications/index.js create mode 100644 app/javascript/mastodon/features/notifications/index.jsx delete mode 100644 app/javascript/mastodon/features/picture_in_picture/components/footer.js create mode 100644 app/javascript/mastodon/features/picture_in_picture/components/footer.jsx delete mode 100644 app/javascript/mastodon/features/picture_in_picture/components/header.js create mode 100644 app/javascript/mastodon/features/picture_in_picture/components/header.jsx delete mode 100644 app/javascript/mastodon/features/picture_in_picture/index.js create mode 100644 app/javascript/mastodon/features/picture_in_picture/index.jsx delete mode 100644 app/javascript/mastodon/features/pinned_statuses/index.js create mode 100644 app/javascript/mastodon/features/pinned_statuses/index.jsx delete mode 100644 app/javascript/mastodon/features/privacy_policy/index.js create mode 100644 app/javascript/mastodon/features/privacy_policy/index.jsx delete mode 100644 app/javascript/mastodon/features/public_timeline/components/column_settings.js create mode 100644 app/javascript/mastodon/features/public_timeline/components/column_settings.jsx delete mode 100644 app/javascript/mastodon/features/public_timeline/index.js create mode 100644 app/javascript/mastodon/features/public_timeline/index.jsx delete mode 100644 app/javascript/mastodon/features/reblogs/index.js create mode 100644 app/javascript/mastodon/features/reblogs/index.jsx delete mode 100644 app/javascript/mastodon/features/report/category.js create mode 100644 app/javascript/mastodon/features/report/category.jsx delete mode 100644 app/javascript/mastodon/features/report/comment.js create mode 100644 app/javascript/mastodon/features/report/comment.jsx delete mode 100644 app/javascript/mastodon/features/report/components/option.js create mode 100644 app/javascript/mastodon/features/report/components/option.jsx delete mode 100644 app/javascript/mastodon/features/report/components/status_check_box.js create mode 100644 app/javascript/mastodon/features/report/components/status_check_box.jsx delete mode 100644 app/javascript/mastodon/features/report/rules.js create mode 100644 app/javascript/mastodon/features/report/rules.jsx delete mode 100644 app/javascript/mastodon/features/report/statuses.js create mode 100644 app/javascript/mastodon/features/report/statuses.jsx delete mode 100644 app/javascript/mastodon/features/report/thanks.js create mode 100644 app/javascript/mastodon/features/report/thanks.jsx delete mode 100644 app/javascript/mastodon/features/standalone/compose/index.js create mode 100644 app/javascript/mastodon/features/standalone/compose/index.jsx delete mode 100644 app/javascript/mastodon/features/status/components/action_bar.js create mode 100644 app/javascript/mastodon/features/status/components/action_bar.jsx delete mode 100644 app/javascript/mastodon/features/status/components/card.js create mode 100644 app/javascript/mastodon/features/status/components/card.jsx delete mode 100644 app/javascript/mastodon/features/status/components/detailed_status.js create mode 100644 app/javascript/mastodon/features/status/components/detailed_status.jsx delete mode 100644 app/javascript/mastodon/features/status/index.js create mode 100644 app/javascript/mastodon/features/status/index.jsx delete mode 100644 app/javascript/mastodon/features/subscribed_languages_modal/index.js create mode 100644 app/javascript/mastodon/features/subscribed_languages_modal/index.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/__tests__/column-test.js create mode 100644 app/javascript/mastodon/features/ui/components/__tests__/column-test.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/actions_modal.js create mode 100644 app/javascript/mastodon/features/ui/components/actions_modal.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/audio_modal.js create mode 100644 app/javascript/mastodon/features/ui/components/audio_modal.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/block_modal.js create mode 100644 app/javascript/mastodon/features/ui/components/block_modal.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/boost_modal.js create mode 100644 app/javascript/mastodon/features/ui/components/boost_modal.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/bundle.js create mode 100644 app/javascript/mastodon/features/ui/components/bundle.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/bundle_column_error.js create mode 100644 app/javascript/mastodon/features/ui/components/bundle_column_error.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/bundle_modal_error.js create mode 100644 app/javascript/mastodon/features/ui/components/bundle_modal_error.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/column.js create mode 100644 app/javascript/mastodon/features/ui/components/column.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/column_header.js create mode 100644 app/javascript/mastodon/features/ui/components/column_header.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/column_link.js create mode 100644 app/javascript/mastodon/features/ui/components/column_link.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/column_loading.js create mode 100644 app/javascript/mastodon/features/ui/components/column_loading.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/column_subheading.js create mode 100644 app/javascript/mastodon/features/ui/components/column_subheading.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/columns_area.js create mode 100644 app/javascript/mastodon/features/ui/components/columns_area.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/compare_history_modal.js create mode 100644 app/javascript/mastodon/features/ui/components/compare_history_modal.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/compose_panel.js create mode 100644 app/javascript/mastodon/features/ui/components/compose_panel.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/confirmation_modal.js create mode 100644 app/javascript/mastodon/features/ui/components/confirmation_modal.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/disabled_account_banner.js create mode 100644 app/javascript/mastodon/features/ui/components/disabled_account_banner.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/drawer_loading.js create mode 100644 app/javascript/mastodon/features/ui/components/drawer_loading.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/embed_modal.js create mode 100644 app/javascript/mastodon/features/ui/components/embed_modal.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/filter_modal.js create mode 100644 app/javascript/mastodon/features/ui/components/filter_modal.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/focal_point_modal.js create mode 100644 app/javascript/mastodon/features/ui/components/focal_point_modal.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/follow_requests_column_link.js create mode 100644 app/javascript/mastodon/features/ui/components/follow_requests_column_link.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/header.js create mode 100644 app/javascript/mastodon/features/ui/components/header.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/image_loader.js create mode 100644 app/javascript/mastodon/features/ui/components/image_loader.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/image_modal.js create mode 100644 app/javascript/mastodon/features/ui/components/image_modal.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/link_footer.js create mode 100644 app/javascript/mastodon/features/ui/components/link_footer.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/list_panel.js create mode 100644 app/javascript/mastodon/features/ui/components/list_panel.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/media_modal.js create mode 100644 app/javascript/mastodon/features/ui/components/media_modal.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/modal_loading.js create mode 100644 app/javascript/mastodon/features/ui/components/modal_loading.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/modal_root.js create mode 100644 app/javascript/mastodon/features/ui/components/modal_root.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/mute_modal.js create mode 100644 app/javascript/mastodon/features/ui/components/mute_modal.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/navigation_panel.js create mode 100644 app/javascript/mastodon/features/ui/components/navigation_panel.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/report_modal.js create mode 100644 app/javascript/mastodon/features/ui/components/report_modal.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/sign_in_banner.js create mode 100644 app/javascript/mastodon/features/ui/components/sign_in_banner.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/upload_area.js create mode 100644 app/javascript/mastodon/features/ui/components/upload_area.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/video_modal.js create mode 100644 app/javascript/mastodon/features/ui/components/video_modal.jsx delete mode 100644 app/javascript/mastodon/features/ui/components/zoomable_image.js create mode 100644 app/javascript/mastodon/features/ui/components/zoomable_image.jsx delete mode 100644 app/javascript/mastodon/features/ui/index.js create mode 100644 app/javascript/mastodon/features/ui/index.jsx delete mode 100644 app/javascript/mastodon/features/ui/util/react_router_helpers.js create mode 100644 app/javascript/mastodon/features/ui/util/react_router_helpers.jsx delete mode 100644 app/javascript/mastodon/features/ui/util/reduced_motion.js create mode 100644 app/javascript/mastodon/features/ui/util/reduced_motion.jsx delete mode 100644 app/javascript/mastodon/features/video/index.js create mode 100644 app/javascript/mastodon/features/video/index.jsx delete mode 100644 app/javascript/mastodon/main.js create mode 100644 app/javascript/mastodon/main.jsx delete mode 100644 app/javascript/mastodon/utils/icons.js create mode 100644 app/javascript/mastodon/utils/icons.jsx delete mode 100644 app/javascript/packs/admin.js create mode 100644 app/javascript/packs/admin.jsx delete mode 100644 app/javascript/packs/public.js create mode 100644 app/javascript/packs/public.jsx delete mode 100644 app/javascript/packs/share.js create mode 100644 app/javascript/packs/share.jsx diff --git a/.eslintrc.js b/.eslintrc.js index b5ab511f8..606a87e41 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -43,7 +43,7 @@ module.exports = { version: 'detect', }, 'import/extensions': [ - '.js', + '.js', '.jsx', ], 'import/ignore': [ 'node_modules', @@ -52,6 +52,7 @@ module.exports = { 'import/resolver': { node: { paths: ['app/javascript'], + extensions: ['.js', '.jsx'], }, }, }, @@ -111,6 +112,7 @@ module.exports = { semi: 'error', 'valid-typeof': 'error', + 'react/jsx-filename-extension': ['error', { 'allow': 'as-needed' }], 'react/jsx-boolean-value': 'error', 'react/jsx-closing-bracket-location': ['error', 'line-aligned'], 'react/jsx-curly-spacing': 'error', @@ -185,6 +187,7 @@ module.exports = { 'always', { js: 'never', + jsx: 'never', }, ], 'import/newline-after-import': 'error', diff --git a/.github/workflows/lint-js.yml b/.github/workflows/lint-js.yml index 3e0d9d1a9..44929f63d 100644 --- a/.github/workflows/lint-js.yml +++ b/.github/workflows/lint-js.yml @@ -10,6 +10,7 @@ on: - '.prettier*' - '.eslint*' - '**/*.js' + - '**/*.jsx' - '.github/workflows/lint-js.yml' pull_request: @@ -20,6 +21,7 @@ on: - '.prettier*' - '.eslint*' - '**/*.js' + - '**/*.jsx' - '.github/workflows/lint-js.yml' jobs: diff --git a/.github/workflows/test-js.yml b/.github/workflows/test-js.yml index 60b8e318e..6a1cacb3f 100644 --- a/.github/workflows/test-js.yml +++ b/.github/workflows/test-js.yml @@ -8,6 +8,7 @@ on: - 'yarn.lock' - '.nvmrc' - '**/*.js' + - '**/*.jsx' - '**/*.snap' - '.github/workflows/test-js.yml' @@ -17,6 +18,7 @@ on: - 'yarn.lock' - '.nvmrc' - '**/*.js' + - '**/*.jsx' - '**/*.snap' - '.github/workflows/test-js.yml' diff --git a/app/javascript/mastodon/components/__tests__/__snapshots__/autosuggest_emoji-test.js.snap b/app/javascript/mastodon/components/__tests__/__snapshots__/autosuggest_emoji-test.js.snap deleted file mode 100644 index 1c3727848..000000000 --- a/app/javascript/mastodon/components/__tests__/__snapshots__/autosuggest_emoji-test.js.snap +++ /dev/null @@ -1,27 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` renders emoji with custom url 1`] = ` -
- foobar - :foobar: -
-`; - -exports[` renders native emoji 1`] = ` -
- 💙 - :foobar: -
-`; diff --git a/app/javascript/mastodon/components/__tests__/__snapshots__/autosuggest_emoji-test.jsx.snap b/app/javascript/mastodon/components/__tests__/__snapshots__/autosuggest_emoji-test.jsx.snap new file mode 100644 index 000000000..1c3727848 --- /dev/null +++ b/app/javascript/mastodon/components/__tests__/__snapshots__/autosuggest_emoji-test.jsx.snap @@ -0,0 +1,27 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[` renders emoji with custom url 1`] = ` +
+ foobar + :foobar: +
+`; + +exports[` renders native emoji 1`] = ` +
+ 💙 + :foobar: +
+`; diff --git a/app/javascript/mastodon/components/__tests__/__snapshots__/avatar-test.js.snap b/app/javascript/mastodon/components/__tests__/__snapshots__/avatar-test.js.snap deleted file mode 100644 index 7fbdedeb2..000000000 --- a/app/javascript/mastodon/components/__tests__/__snapshots__/avatar-test.js.snap +++ /dev/null @@ -1,39 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` Autoplay renders a animated avatar 1`] = ` -
- alice -
-`; - -exports[` Still renders a still avatar 1`] = ` -
- alice -
-`; diff --git a/app/javascript/mastodon/components/__tests__/__snapshots__/avatar-test.jsx.snap b/app/javascript/mastodon/components/__tests__/__snapshots__/avatar-test.jsx.snap new file mode 100644 index 000000000..7fbdedeb2 --- /dev/null +++ b/app/javascript/mastodon/components/__tests__/__snapshots__/avatar-test.jsx.snap @@ -0,0 +1,39 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[` Autoplay renders a animated avatar 1`] = ` +
+ alice +
+`; + +exports[` Still renders a still avatar 1`] = ` +
+ alice +
+`; diff --git a/app/javascript/mastodon/components/__tests__/__snapshots__/avatar_overlay-test.js.snap b/app/javascript/mastodon/components/__tests__/__snapshots__/avatar_overlay-test.js.snap deleted file mode 100644 index f8385357a..000000000 --- a/app/javascript/mastodon/components/__tests__/__snapshots__/avatar_overlay-test.js.snap +++ /dev/null @@ -1,54 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` -
-
- alice -
-
-
-
- eve@blackhat.lair -
-
- -`; diff --git a/app/javascript/mastodon/components/__tests__/__snapshots__/avatar_overlay-test.jsx.snap b/app/javascript/mastodon/components/__tests__/__snapshots__/avatar_overlay-test.jsx.snap new file mode 100644 index 000000000..f8385357a --- /dev/null +++ b/app/javascript/mastodon/components/__tests__/__snapshots__/avatar_overlay-test.jsx.snap @@ -0,0 +1,54 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[` +
+
+ alice +
+
+
+
+ eve@blackhat.lair +
+
+ +`; diff --git a/app/javascript/mastodon/components/__tests__/__snapshots__/button-test.js.snap b/app/javascript/mastodon/components/__tests__/__snapshots__/button-test.js.snap deleted file mode 100644 index bfc091d45..000000000 --- a/app/javascript/mastodon/components/__tests__/__snapshots__/button-test.js.snap +++ /dev/null @@ -1,66 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` -`; - -exports[` -`; - -exports[` -`; diff --git a/app/javascript/mastodon/components/__tests__/__snapshots__/button-test.jsx.snap b/app/javascript/mastodon/components/__tests__/__snapshots__/button-test.jsx.snap new file mode 100644 index 000000000..bfc091d45 --- /dev/null +++ b/app/javascript/mastodon/components/__tests__/__snapshots__/button-test.jsx.snap @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[` +`; + +exports[` +`; + +exports[` +`; diff --git a/app/javascript/mastodon/components/__tests__/__snapshots__/display_name-test.js.snap b/app/javascript/mastodon/components/__tests__/__snapshots__/display_name-test.js.snap deleted file mode 100644 index 9c37580d7..000000000 --- a/app/javascript/mastodon/components/__tests__/__snapshots__/display_name-test.js.snap +++ /dev/null @@ -1,27 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` renders display name + account name 1`] = ` - - - Foo

", - } - } - /> -
- - - @ - bar@baz - -
-`; diff --git a/app/javascript/mastodon/components/__tests__/__snapshots__/display_name-test.jsx.snap b/app/javascript/mastodon/components/__tests__/__snapshots__/display_name-test.jsx.snap new file mode 100644 index 000000000..9c37580d7 --- /dev/null +++ b/app/javascript/mastodon/components/__tests__/__snapshots__/display_name-test.jsx.snap @@ -0,0 +1,27 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[` renders display name + account name 1`] = ` + + + Foo

", + } + } + /> +
+ + + @ + bar@baz + +
+`; diff --git a/app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.js b/app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.js deleted file mode 100644 index 05616e444..000000000 --- a/app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.js +++ /dev/null @@ -1,29 +0,0 @@ -import React from 'react'; -import renderer from 'react-test-renderer'; -import AutosuggestEmoji from '../autosuggest_emoji'; - -describe('', () => { - it('renders native emoji', () => { - const emoji = { - native: '💙', - colons: ':foobar:', - }; - const component = renderer.create(); - const tree = component.toJSON(); - - expect(tree).toMatchSnapshot(); - }); - - it('renders emoji with custom url', () => { - const emoji = { - custom: true, - imageUrl: 'http://example.com/emoji.png', - native: 'foobar', - colons: ':foobar:', - }; - const component = renderer.create(); - const tree = component.toJSON(); - - expect(tree).toMatchSnapshot(); - }); -}); diff --git a/app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.jsx b/app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.jsx new file mode 100644 index 000000000..05616e444 --- /dev/null +++ b/app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.jsx @@ -0,0 +1,29 @@ +import React from 'react'; +import renderer from 'react-test-renderer'; +import AutosuggestEmoji from '../autosuggest_emoji'; + +describe('', () => { + it('renders native emoji', () => { + const emoji = { + native: '💙', + colons: ':foobar:', + }; + const component = renderer.create(); + const tree = component.toJSON(); + + expect(tree).toMatchSnapshot(); + }); + + it('renders emoji with custom url', () => { + const emoji = { + custom: true, + imageUrl: 'http://example.com/emoji.png', + native: 'foobar', + colons: ':foobar:', + }; + const component = renderer.create(); + const tree = component.toJSON(); + + expect(tree).toMatchSnapshot(); + }); +}); diff --git a/app/javascript/mastodon/components/__tests__/avatar-test.js b/app/javascript/mastodon/components/__tests__/avatar-test.js deleted file mode 100644 index dd3f7b7d2..000000000 --- a/app/javascript/mastodon/components/__tests__/avatar-test.js +++ /dev/null @@ -1,36 +0,0 @@ -import React from 'react'; -import renderer from 'react-test-renderer'; -import { fromJS } from 'immutable'; -import Avatar from '../avatar'; - -describe('', () => { - const account = fromJS({ - username: 'alice', - acct: 'alice', - display_name: 'Alice', - avatar: '/animated/alice.gif', - avatar_static: '/static/alice.jpg', - }); - - const size = 100; - - describe('Autoplay', () => { - it('renders a animated avatar', () => { - const component = renderer.create(); - const tree = component.toJSON(); - - expect(tree).toMatchSnapshot(); - }); - }); - - describe('Still', () => { - it('renders a still avatar', () => { - const component = renderer.create(); - const tree = component.toJSON(); - - expect(tree).toMatchSnapshot(); - }); - }); - - // TODO add autoplay test if possible -}); diff --git a/app/javascript/mastodon/components/__tests__/avatar-test.jsx b/app/javascript/mastodon/components/__tests__/avatar-test.jsx new file mode 100644 index 000000000..dd3f7b7d2 --- /dev/null +++ b/app/javascript/mastodon/components/__tests__/avatar-test.jsx @@ -0,0 +1,36 @@ +import React from 'react'; +import renderer from 'react-test-renderer'; +import { fromJS } from 'immutable'; +import Avatar from '../avatar'; + +describe('', () => { + const account = fromJS({ + username: 'alice', + acct: 'alice', + display_name: 'Alice', + avatar: '/animated/alice.gif', + avatar_static: '/static/alice.jpg', + }); + + const size = 100; + + describe('Autoplay', () => { + it('renders a animated avatar', () => { + const component = renderer.create(); + const tree = component.toJSON(); + + expect(tree).toMatchSnapshot(); + }); + }); + + describe('Still', () => { + it('renders a still avatar', () => { + const component = renderer.create(); + const tree = component.toJSON(); + + expect(tree).toMatchSnapshot(); + }); + }); + + // TODO add autoplay test if possible +}); diff --git a/app/javascript/mastodon/components/__tests__/avatar_overlay-test.js b/app/javascript/mastodon/components/__tests__/avatar_overlay-test.js deleted file mode 100644 index 44addea83..000000000 --- a/app/javascript/mastodon/components/__tests__/avatar_overlay-test.js +++ /dev/null @@ -1,29 +0,0 @@ -import React from 'react'; -import renderer from 'react-test-renderer'; -import { fromJS } from 'immutable'; -import AvatarOverlay from '../avatar_overlay'; - -describe(' { - const account = fromJS({ - username: 'alice', - acct: 'alice', - display_name: 'Alice', - avatar: '/animated/alice.gif', - avatar_static: '/static/alice.jpg', - }); - - const friend = fromJS({ - username: 'eve', - acct: 'eve@blackhat.lair', - display_name: 'Evelyn', - avatar: '/animated/eve.gif', - avatar_static: '/static/eve.jpg', - }); - - it('renders a overlay avatar', () => { - const component = renderer.create(); - const tree = component.toJSON(); - - expect(tree).toMatchSnapshot(); - }); -}); diff --git a/app/javascript/mastodon/components/__tests__/avatar_overlay-test.jsx b/app/javascript/mastodon/components/__tests__/avatar_overlay-test.jsx new file mode 100644 index 000000000..44addea83 --- /dev/null +++ b/app/javascript/mastodon/components/__tests__/avatar_overlay-test.jsx @@ -0,0 +1,29 @@ +import React from 'react'; +import renderer from 'react-test-renderer'; +import { fromJS } from 'immutable'; +import AvatarOverlay from '../avatar_overlay'; + +describe(' { + const account = fromJS({ + username: 'alice', + acct: 'alice', + display_name: 'Alice', + avatar: '/animated/alice.gif', + avatar_static: '/static/alice.jpg', + }); + + const friend = fromJS({ + username: 'eve', + acct: 'eve@blackhat.lair', + display_name: 'Evelyn', + avatar: '/animated/eve.gif', + avatar_static: '/static/eve.jpg', + }); + + it('renders a overlay avatar', () => { + const component = renderer.create(); + const tree = component.toJSON(); + + expect(tree).toMatchSnapshot(); + }); +}); diff --git a/app/javascript/mastodon/components/__tests__/button-test.js b/app/javascript/mastodon/components/__tests__/button-test.js deleted file mode 100644 index f5a649f70..000000000 --- a/app/javascript/mastodon/components/__tests__/button-test.js +++ /dev/null @@ -1,75 +0,0 @@ -import { render, fireEvent, screen } from '@testing-library/react'; -import React from 'react'; -import renderer from 'react-test-renderer'; -import Button from '../button'; - -describe('); - fireEvent.click(screen.getByText('button')); - - expect(handler.mock.calls.length).toEqual(1); - }); - - it('does not handle click events if props.disabled given', () => { - const handler = jest.fn(); - render(); - fireEvent.click(screen.getByText('button')); - - expect(handler.mock.calls.length).toEqual(0); - }); - - it('renders a disabled attribute if props.disabled given', () => { - const component = renderer.create(); - const tree = component.toJSON(); - - expect(tree).toMatchSnapshot(); - }); - - it('renders the props.text instead of children', () => { - const text = 'foo'; - const children =

children

; - const component = renderer.create(); - const tree = component.toJSON(); - - expect(tree).toMatchSnapshot(); - }); - - it('renders class="button--block" if props.block given', () => { - const component = renderer.create(); + fireEvent.click(screen.getByText('button')); + + expect(handler.mock.calls.length).toEqual(1); + }); + + it('does not handle click events if props.disabled given', () => { + const handler = jest.fn(); + render(); + fireEvent.click(screen.getByText('button')); + + expect(handler.mock.calls.length).toEqual(0); + }); + + it('renders a disabled attribute if props.disabled given', () => { + const component = renderer.create(); + const tree = component.toJSON(); + + expect(tree).toMatchSnapshot(); + }); + + it('renders the props.text instead of children', () => { + const text = 'foo'; + const children =

children

; + const component = renderer.create(); + const tree = component.toJSON(); + + expect(tree).toMatchSnapshot(); + }); + + it('renders class="button--block" if props.block given', () => { + const component = renderer.create(