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

This commit is contained in:
KMY 2023-11-24 09:07:40 +09:00
commit c5e4020922
206 changed files with 1987 additions and 965 deletions

View file

@ -24,7 +24,7 @@ RSpec.describe ActivityPub::Activity::Create do
stub_request(:get, 'http://example.com/emojib.png').to_return(body: attachment_fixture('emojo.png'), headers: { 'Content-Type' => 'application/octet-stream' })
end
describe 'processing posts received out of order' do
describe 'processing posts received out of order', :sidekiq_fake do
let(:follower) { Fabricate(:account, username: 'bob') }
let(:object_json) do
@ -78,13 +78,6 @@ RSpec.describe ActivityPub::Activity::Create do
follower.follow!(sender)
end
around do |example|
Sidekiq::Testing.fake! do
example.run
Sidekiq::Worker.clear_all
end
end
it 'correctly processes posts and inserts them in timelines', :aggregate_failures do
# Simulate a temporary failure preventing from fetching the parent post
stub_request(:get, object_json[:id]).to_return(status: 500)

View file

@ -465,7 +465,7 @@ describe Mastodon::CLI::Accounts do
end
describe '#approve' do
let(:total_users) { 10 }
let(:total_users) { 4 }
before do
Form::AdminSettings.new(registrations_mode: 'approved').save
@ -482,7 +482,7 @@ describe Mastodon::CLI::Accounts do
context 'with --number option' do
context 'when the number is positive' do
let(:options) { { number: 3 } }
let(:options) { { number: 2 } }
it 'approves the earliest n pending registrations' do
cli.invoke(:approve, nil, options)
@ -779,6 +779,8 @@ describe Mastodon::CLI::Accounts do
let(:arguments) { [account_example_com_a.acct, account_example_com_b.acct] }
before do
# NOTE: `Account.find_remote` is stubbed so that `Account#reset_avatar!`
# can be stubbed on the individual accounts.
allow(Account).to receive(:find_remote).with(account_example_com_a.username, account_example_com_a.domain).and_return(account_example_com_a)
allow(Account).to receive(:find_remote).with(account_example_com_b.username, account_example_com_b.domain).and_return(account_example_com_b)
allow(Account).to receive(:find_remote).with(account_example_net.username, account_example_net.domain).and_return(account_example_net)
@ -978,11 +980,10 @@ describe Mastodon::CLI::Accounts do
end
context 'when --all option is provided' do
let(:accounts) { Fabricate.times(3, :account) }
let(:options) { { all: true } }
let!(:accounts) { Fabricate.times(2, :account) }
let(:options) { { all: true } }
before do
allow(Account).to receive(:local).and_return(Account.where(id: accounts.map(&:id)))
cli.options = { all: true }
end
@ -1269,7 +1270,7 @@ describe Mastodon::CLI::Accounts do
end
context 'when the given username is found' do
let(:total_relationships) { 10 }
let(:total_relationships) { 3 }
let!(:accounts) { Fabricate.times(total_relationships, :account) }
context 'with --follows option' do
@ -1324,8 +1325,8 @@ describe Mastodon::CLI::Accounts do
let(:options) { { followers: true, follows: true } }
before do
accounts.first(6).each { |account| account.follow!(target_account) }
accounts.last(4).each { |account| target_account.follow!(account) }
accounts.first(2).each { |account| account.follow!(target_account) }
accounts.last(1).each { |account| target_account.follow!(account) }
end
it 'resets all "followers" relationships from the target account' do
@ -1363,7 +1364,7 @@ describe Mastodon::CLI::Accounts do
let!(:group_account) { Fabricate(:account, actor_type: 'Group', domain: 'example.com') }
let!(:mentioned_account) { Fabricate(:account, domain: 'example.com') }
let!(:prunable_accounts) do
Fabricate.times(3, :account, domain: 'example.com', bot: false, suspended_at: nil, silenced_at: nil)
Fabricate.times(2, :account, domain: 'example.com', bot: false, suspended_at: nil, silenced_at: nil)
end
before do
@ -1581,8 +1582,7 @@ describe Mastodon::CLI::Accounts do
context 'when the specified account is redirecting to a different target account' do
before do
allow(Account).to receive(:find_local).with(source_account.username).and_return(source_account)
allow(source_account).to receive(:moved_to_account_id).and_return(-1)
source_account.update(moved_to_account: Fabricate(:account))
end
it 'exits with an error message' do
@ -1597,9 +1597,8 @@ describe Mastodon::CLI::Accounts do
let(:options) { { target: target_account.acct, force: true } }
before do
source_account.update(moved_to_account: Fabricate(:account))
target_account.aliases.create!(acct: source_account.acct)
allow(Account).to receive(:find_local).with(source_account.username).and_return(source_account)
allow(source_account).to receive(:moved_to_account_id).and_return(-1)
end
it_behaves_like 'a successful migration'