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) --- 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 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'app') 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 -- 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(-) (limited to 'app') 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 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(-) (limited to 'app') 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 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(-) (limited to 'app') 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 (limited to 'app') 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(