mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Autofix Rubocop Style/HashAsLastArrayItem
https://docs.rubocop.org/rubocop/cops_style.html#stylehashaslastarrayitem
This commit is contained in:
parent
2b10b0e027
commit
415e1fac4a
8 changed files with 14 additions and 17 deletions
|
@ -12,9 +12,6 @@ Style/FormatStringToken:
|
|||
merge:
|
||||
- AllowedMethods
|
||||
|
||||
Style/HashAsLastArrayItem:
|
||||
Enabled: false
|
||||
|
||||
Style/HashSyntax:
|
||||
EnforcedShorthandSyntax: either
|
||||
EnforcedStyle: ruby19_no_mixed_keys
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 }],
|
||||
},
|
||||
]
|
||||
)
|
||||
|
|
|
@ -169,7 +169,7 @@ class Api::V1::StatusesController < Api::BaseController
|
|||
:multiple,
|
||||
:hide_totals,
|
||||
:expires_in,
|
||||
options: [],
|
||||
{ options: [] },
|
||||
]
|
||||
)
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue