mirror of
https://github.com/mastodon/mastodon.git
synced 2026-03-21 18:05:23 -05:00
Update rubocop to version 1.8.40 (#37628)
This commit is contained in:
parent
bc3871f992
commit
23148dc536
|
|
@ -754,7 +754,7 @@ GEM
|
|||
rspec-mocks (~> 3.0)
|
||||
sidekiq (>= 5, < 9)
|
||||
rspec-support (3.13.6)
|
||||
rubocop (1.82.1)
|
||||
rubocop (1.84.0)
|
||||
json (~> 2.3)
|
||||
language_server-protocol (~> 3.17.0.2)
|
||||
lint_roller (~> 1.1.0)
|
||||
|
|
@ -762,7 +762,7 @@ GEM
|
|||
parser (>= 3.3.0.2)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 2.9.3, < 3.0)
|
||||
rubocop-ast (>= 1.48.0, < 2.0)
|
||||
rubocop-ast (>= 1.49.0, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 2.4.0, < 4.0)
|
||||
rubocop-ast (1.49.0)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class Admin::Metrics::Dimension::TagServersDimension < Admin::Metrics::Dimension
|
|||
end
|
||||
|
||||
def sql_query_string
|
||||
<<-SQL.squish
|
||||
<<~SQL.squish
|
||||
SELECT accounts.domain, count(*) AS value
|
||||
FROM statuses
|
||||
INNER JOIN accounts ON accounts.id = statuses.account_id
|
||||
|
|
|
|||
|
|
@ -49,7 +49,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]
|
||||
|
|
@ -73,7 +73,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
|
||||
|
|
|
|||
|
|
@ -84,7 +84,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
|
||||
|
|
|
|||
|
|
@ -48,11 +48,11 @@ class MoveWorker
|
|||
source_local_followers
|
||||
.where(account: @target_account.followers.local)
|
||||
.in_batches do |follows|
|
||||
ListAccount.where(follow: follows).includes(:list).find_each do |list_account|
|
||||
list_account.list.accounts << @target_account
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
nil
|
||||
end
|
||||
ListAccount.where(follow: follows).includes(:list).find_each do |list_account|
|
||||
list_account.list.accounts << @target_account
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
# Finally, handle the common case of accounts not following the new account
|
||||
|
|
@ -60,8 +60,8 @@ class MoveWorker
|
|||
.where.not(account: @target_account.followers.local)
|
||||
.where.not(account_id: @target_account.id)
|
||||
.in_batches do |follows|
|
||||
ListAccount.where(follow: follows).in_batches.update_all(account_id: @target_account.id)
|
||||
num_moved += follows.update_all(target_account_id: @target_account.id)
|
||||
ListAccount.where(follow: follows).in_batches.update_all(account_id: @target_account.id)
|
||||
num_moved += follows.update_all(target_account_id: @target_account.id)
|
||||
end
|
||||
|
||||
num_moved
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ class RejectFollowingBlockedUsers < ActiveRecord::Migration[5.2]
|
|||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
blocked_follows = Follow.find_by_sql(<<-SQL.squish)
|
||||
blocked_follows = Follow.find_by_sql(<<~SQL.squish)
|
||||
select f.* from follows f
|
||||
inner join blocks b on
|
||||
f.account_id = b.target_account_id and
|
||||
f.target_account_id = b.account_id
|
||||
SQL
|
||||
|
||||
domain_blocked_follows = Follow.find_by_sql(<<-SQL.squish)
|
||||
domain_blocked_follows = Follow.find_by_sql(<<~SQL.squish)
|
||||
select f.* from follows f
|
||||
inner join accounts following on f.account_id = following.id
|
||||
inner join account_domain_blocks b on
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class CopyStatusStats < ActiveRecord::Migration[5.2]
|
|||
say 'Upsert is available, importing counters using the fast method'
|
||||
|
||||
Status.unscoped.select('id').find_in_batches(batch_size: 5_000) do |statuses|
|
||||
execute <<-SQL.squish
|
||||
execute <<~SQL.squish
|
||||
INSERT INTO status_stats (status_id, reblogs_count, favourites_count, created_at, updated_at)
|
||||
SELECT id, reblogs_count, favourites_count, created_at, updated_at
|
||||
FROM statuses
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class CopyAccountStats < ActiveRecord::Migration[5.2]
|
|||
say 'Upsert is available, importing counters using the fast method'
|
||||
|
||||
MigrationAccount.unscoped.select('id').find_in_batches(batch_size: 5_000) do |accounts|
|
||||
execute <<-SQL.squish
|
||||
execute <<~SQL.squish
|
||||
INSERT INTO account_stats (account_id, statuses_count, following_count, followers_count, created_at, updated_at)
|
||||
SELECT id, statuses_count, following_count, followers_count, created_at, updated_at
|
||||
FROM accounts
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class MigrateCustomFilters < ActiveRecord::Migration[6.1]
|
|||
# Preserve IDs as much as possible to not confuse existing clients.
|
||||
# As long as this migration is irreversible, we do not have to deal with conflicts.
|
||||
safety_assured do
|
||||
execute <<-SQL.squish
|
||||
execute <<~SQL.squish
|
||||
INSERT INTO custom_filter_keywords (id, custom_filter_id, keyword, whole_word, created_at, updated_at)
|
||||
SELECT id, id, phrase, whole_word, created_at, updated_at
|
||||
FROM custom_filters
|
||||
|
|
@ -16,7 +16,7 @@ class MigrateCustomFilters < ActiveRecord::Migration[6.1]
|
|||
def down
|
||||
# Copy back changes from custom filters guaranteed to be from the old API
|
||||
safety_assured do
|
||||
execute <<-SQL.squish
|
||||
execute <<~SQL.squish
|
||||
UPDATE custom_filters
|
||||
SET phrase = custom_filter_keywords.keyword, whole_word = custom_filter_keywords.whole_word
|
||||
FROM custom_filter_keywords
|
||||
|
|
@ -26,7 +26,7 @@ class MigrateCustomFilters < ActiveRecord::Migration[6.1]
|
|||
|
||||
# Drop every keyword as we can't safely provide a 1:1 mapping
|
||||
safety_assured do
|
||||
execute <<-SQL.squish
|
||||
execute <<~SQL.squish
|
||||
TRUNCATE custom_filter_keywords RESTART IDENTITY
|
||||
SQL
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ class RemoveBoostsWideningAudience < ActiveRecord::Migration[5.2]
|
|||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
public_boosts = Status.find_by_sql(<<-SQL.squish)
|
||||
public_boosts = Status.find_by_sql(<<~SQL.squish)
|
||||
SELECT boost.id
|
||||
FROM statuses AS boost
|
||||
LEFT JOIN statuses AS boosted ON boost.reblog_of_id = boosted.id
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class FixCustomFilterKeywordsIdSeq < ActiveRecord::Migration[6.1]
|
|||
# 20220613110711 manually inserts items with set `id` in the database, but
|
||||
# we also need to bump the sequence number, otherwise
|
||||
safety_assured do
|
||||
execute <<-SQL.squish
|
||||
execute <<~SQL.squish
|
||||
BEGIN;
|
||||
LOCK TABLE custom_filter_keywords IN EXCLUSIVE MODE;
|
||||
SELECT setval('custom_filter_keywords_id_seq'::regclass, id) FROM custom_filter_keywords ORDER BY id DESC LIMIT 1;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ module Mastodon::CLI
|
|||
# Skip accounts followed by local accounts
|
||||
clean_followed_sql = 'AND NOT EXISTS (SELECT 1 FROM follows WHERE statuses.account_id = follows.target_account_id)' unless options[:clean_followed]
|
||||
|
||||
ActiveRecord::Base.connection.exec_insert(<<-SQL.squish, 'SQL', [max_id])
|
||||
ActiveRecord::Base.connection.exec_insert(<<~SQL.squish, 'SQL', [max_id])
|
||||
INSERT INTO statuses_to_be_deleted (id)
|
||||
SELECT statuses.id FROM statuses WHERE deleted_at IS NULL AND NOT local AND uri IS NOT NULL AND (id < $1)
|
||||
AND NOT EXISTS (SELECT 1 FROM statuses AS statuses1 WHERE statuses.id = statuses1.in_reply_to_id)
|
||||
|
|
@ -137,7 +137,7 @@ module Mastodon::CLI
|
|||
|
||||
ActiveRecord::Base.connection.create_table('conversations_to_be_deleted', force: true)
|
||||
|
||||
ActiveRecord::Base.connection.exec_insert(<<-SQL.squish, 'SQL')
|
||||
ActiveRecord::Base.connection.exec_insert(<<~SQL.squish, 'SQL')
|
||||
INSERT INTO conversations_to_be_deleted (id)
|
||||
SELECT id FROM conversations WHERE NOT EXISTS (SELECT 1 FROM statuses WHERE statuses.conversation_id = conversations.id)
|
||||
SQL
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user