diff --git a/.rubocop/style.yml b/.rubocop/style.yml index 03e35a70ac..b5c3771182 100644 --- a/.rubocop/style.yml +++ b/.rubocop/style.yml @@ -12,9 +12,6 @@ Style/FormatStringToken: merge: - AllowedMethods -Style/HashAsLastArrayItem: - Enabled: false - Style/HashSyntax: EnforcedShorthandSyntax: either EnforcedStyle: ruby19_no_mixed_keys diff --git a/app/controllers/admin/statuses_controller.rb b/app/controllers/admin/statuses_controller.rb index e53b22dca3..5847f8c710 100644 --- a/app/controllers/admin/statuses_controller.rb +++ b/app/controllers/admin/statuses_controller.rb @@ -59,7 +59,7 @@ module Admin end def set_statuses - @statuses = Admin::StatusFilter.new(@account, filter_params).results.preload(:application, :preloadable_poll, :media_attachments, active_mentions: :account, reblog: [:account, :application, :preloadable_poll, :media_attachments, active_mentions: :account]).page(params[:page]).per(PER_PAGE) + @statuses = Admin::StatusFilter.new(@account, filter_params).results.preload(:application, :preloadable_poll, :media_attachments, active_mentions: :account, reblog: [:account, :application, :preloadable_poll, :media_attachments, { active_mentions: :account }]).page(params[:page]).per(PER_PAGE) end def filter_params diff --git a/app/controllers/api/v1/conversations_controller.rb b/app/controllers/api/v1/conversations_controller.rb index 60db082a8e..c91c0cedd2 100644 --- a/app/controllers/api/v1/conversations_controller.rb +++ b/app/controllers/api/v1/conversations_controller.rb @@ -38,15 +38,15 @@ class Api::V1::ConversationsController < Api::BaseController def paginated_conversations AccountConversation.where(account: current_account) .includes( - account: [:account_stat, user: :role], + account: [:account_stat, { user: :role }], last_status: [ :media_attachments, :status_stat, :tags, { - preview_cards_status: { preview_card: { author_account: [:account_stat, user: :role] } }, + preview_cards_status: { preview_card: { author_account: [:account_stat, { user: :role }] } }, active_mentions: :account, - account: [:account_stat, user: :role], + account: [:account_stat, { user: :role }], }, ] ) diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb index 19cc71ae58..05fa1ecab4 100644 --- a/app/controllers/api/v1/statuses_controller.rb +++ b/app/controllers/api/v1/statuses_controller.rb @@ -169,7 +169,7 @@ class Api::V1::StatusesController < Api::BaseController :multiple, :hide_totals, :expires_in, - options: [], + { options: [] }, ] ) end diff --git a/app/models/concerns/status/threading_concern.rb b/app/models/concerns/status/threading_concern.rb index 478a139d63..a800409b8c 100644 --- a/app/models/concerns/status/threading_concern.rb +++ b/app/models/concerns/status/threading_concern.rb @@ -48,7 +48,7 @@ module Status::ThreadingConcern end def ancestor_statuses(limit) - Status.find_by_sql([<<-SQL.squish, id: in_reply_to_id, limit: limit]) + Status.find_by_sql([<<-SQL.squish, { id: in_reply_to_id, limit: limit }]) WITH RECURSIVE search_tree(id, in_reply_to_id, path) AS ( SELECT id, in_reply_to_id, ARRAY[id] @@ -72,7 +72,7 @@ module Status::ThreadingConcern depth += 1 if depth.present? limit += 1 if limit.present? - descendants_with_self = Status.find_by_sql([<<-SQL.squish, id: id, limit: limit, depth: depth]) + descendants_with_self = Status.find_by_sql([<<-SQL.squish, { id: id, limit: limit, depth: depth }]) WITH RECURSIVE search_tree(id, path) AS ( SELECT id, ARRAY[id] FROM statuses diff --git a/app/models/status.rb b/app/models/status.rb index baa6578005..4b5dc0cc82 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -157,8 +157,8 @@ class Status < ApplicationRecord :status_stat, :tags, :preloadable_poll, - preview_cards_status: { preview_card: { author_account: [:account_stat, user: :role] } }, - account: [:account_stat, user: :role], + preview_cards_status: { preview_card: { author_account: [:account_stat, { user: :role }] } }, + account: [:account_stat, { user: :role }], active_mentions: :account, reblog: [ :application, @@ -167,9 +167,9 @@ class Status < ApplicationRecord :conversation, :status_stat, :preloadable_poll, - preview_cards_status: { preview_card: { author_account: [:account_stat, user: :role] } }, - account: [:account_stat, user: :role], - active_mentions: :account, + { preview_cards_status: { preview_card: { author_account: [:account_stat, { user: :role }] } }, + account: [:account_stat, { user: :role }], + active_mentions: :account }, ], thread: :account diff --git a/app/services/batched_remove_status_service.rb b/app/services/batched_remove_status_service.rb index de4ee16e91..76b9f17da2 100644 --- a/app/services/batched_remove_status_service.rb +++ b/app/services/batched_remove_status_service.rb @@ -10,7 +10,7 @@ class BatchedRemoveStatusService < BaseService def call(statuses, **options) ActiveRecord::Associations::Preloader.new( records: statuses, - associations: options[:skip_side_effects] ? :reblogs : [:account, :tags, reblogs: :account] + associations: options[:skip_side_effects] ? :reblogs : [:account, :tags, { reblogs: :account }] ).call statuses_and_reblogs = statuses.flat_map { |status| [status] + status.reblogs } diff --git a/app/services/notify_service.rb b/app/services/notify_service.rb index d69b5af141..efc1dd91fa 100644 --- a/app/services/notify_service.rb +++ b/app/services/notify_service.rb @@ -153,7 +153,7 @@ class NotifyService < BaseService # This queries private mentions from the recipient to the sender up in the thread. # This allows up to 100 messages that do not match in the thread, allowing conversations # involving multiple people. - Status.count_by_sql([<<-SQL.squish, id: @notification.target_status.in_reply_to_id, recipient_id: @recipient.id, sender_id: @sender.id, depth_limit: 100]) + Status.count_by_sql([<<-SQL.squish, { id: @notification.target_status.in_reply_to_id, recipient_id: @recipient.id, sender_id: @sender.id, depth_limit: 100 }]) WITH RECURSIVE ancestors(id, in_reply_to_id, mention_id, path, depth) AS ( SELECT s.id, s.in_reply_to_id, m.id, ARRAY[s.id], 0 FROM statuses s