Merge remote-tracking branch 'parent/main' into upstream-20240503

This commit is contained in:
KMY 2024-05-03 11:17:22 +09:00
commit 80789a603a
193 changed files with 1871 additions and 1061 deletions

View file

@ -16,7 +16,7 @@ module Devise
if resource && !resource.otp_required_for_login?
success!(resource)
else
fail(:invalid)
fail(:invalid) # rubocop:disable Style/SignalException -- method is from Warden::Strategies::Base
end
end

View file

@ -15,7 +15,7 @@ module Devise
if resource && !resource.otp_required_for_login?
success!(resource)
else
fail(:invalid)
fail(:invalid) # rubocop:disable Style/SignalException -- method is from Warden::Strategies::Base
end
end

View file

@ -191,24 +191,24 @@ module Mastodon::CLI
def vacuum_and_analyze_statuses
if options[:compress_database]
say('Run VACUUM FULL ANALYZE to statuses...')
say('Running "VACUUM FULL ANALYZE statuses"...')
ActiveRecord::Base.connection.execute('VACUUM FULL ANALYZE statuses')
say('Run REINDEX to statuses...')
say('Running "REINDEX TABLE statuses"...')
ActiveRecord::Base.connection.execute('REINDEX TABLE statuses')
else
say('Run ANALYZE to statuses...')
say('Running "ANALYZE statuses"...')
ActiveRecord::Base.connection.execute('ANALYZE statuses')
end
end
def vacuum_and_analyze_conversations
if options[:compress_database]
say('Run VACUUM FULL ANALYZE to conversations...')
say('Running "VACUUM FULL ANALYZE conversations"...')
ActiveRecord::Base.connection.execute('VACUUM FULL ANALYZE conversations')
say('Run REINDEX to conversations...')
say('Running "REINDEX TABLE conversations"...')
ActiveRecord::Base.connection.execute('REINDEX TABLE conversations')
else
say('Run ANALYZE to conversations...')
say('Running "ANALYZE conversations"...')
ActiveRecord::Base.connection.execute('ANALYZE conversations')
end
end

View file

@ -127,6 +127,14 @@ namespace :tests do
exit(1)
end
# This is checking the attribute rather than the method, to avoid the legacy fallback
# and ensure the data has been migrated
unless Account.find_local('qcuser').user[:otp_secret] == 'anotpsecretthatshouldbeencrypted'
puts "DEBUG: #{Account.find_local('qcuser').user.inspect}"
puts 'OTP secret for user not preserved as expected'
exit(1)
end
puts 'No errors found. Database state is consistent with a successful migration process.'
end
@ -213,9 +221,15 @@ namespace :tests do
(4, 10, 'kmruser@localhost', now(), now(), false, 'ku', '{en,kmr,ku,ckb}');
INSERT INTO "users"
(id, account_id, email, created_at, updated_at, locale)
(id, account_id, email, created_at, updated_at, locale,
encrypted_otp_secret, encrypted_otp_secret_iv, encrypted_otp_secret_salt,
otp_required_for_login)
VALUES
(5, 11, 'qcuser@localhost', now(), now(), 'fr-QC');
(5, 11, 'qcuser@localhost', now(), now(), 'fr-QC',
E'Fttsy7QAa0edaDfdfSz094rRLAxc8cJweDQ4BsWH/zozcdVA8o9GLqcKhn2b\nGi/V\n',
'rys3THICkr60BoWC',
'_LMkAGvdg7a+sDIKjI3mR2Q==',
true);
INSERT INTO "settings"
(id, thing_type, thing_id, var, value, created_at, updated_at)