Merge branch 'main' into glitch-soc/merge-upstream

This commit is contained in:
Claire
2022-11-07 19:53:30 +01:00
193 changed files with 2791 additions and 1575 deletions

View File

@@ -28,6 +28,18 @@ describe StatusCacheHydrator do
end
end
context 'when handling a filtered status' do
let(:status) { Fabricate(:status, text: 'this toot is about that banned word') }
before do
account.custom_filters.create!(phrase: 'filter1', context: %w(home), action: :hide, keywords_attributes: [{ keyword: 'banned' }, { keyword: 'irrelevant' }])
end
it 'renders the same attributes as a full render' do
expect(subject).to eql(compare_to_hash)
end
end
context 'when handling a reblog' do
let(:reblog) { Fabricate(:status) }
let(:status) { Fabricate(:status, reblog: reblog) }
@@ -99,6 +111,18 @@ describe StatusCacheHydrator do
expect(subject).to eql(compare_to_hash)
end
end
context 'that matches account filters' do
let(:reblog) { Fabricate(:status, text: 'this toot is about that banned word') }
before do
account.custom_filters.create!(phrase: 'filter1', context: %w(home), action: :hide, keywords_attributes: [{ keyword: 'banned' }, { keyword: 'irrelevant' }])
end
it 'renders the same attributes as a full render' do
expect(subject).to eql(compare_to_hash)
end
end
end
end

View File

@@ -74,6 +74,18 @@ describe MoveWorker do
end
end
shared_examples 'followers count handling' do
it 'updates the source account followers count' do
subject.perform(source_account.id, target_account.id)
expect(source_account.reload.followers_count).to eq(source_account.passive_relationships.count)
end
it 'updates the target account followers count' do
subject.perform(source_account.id, target_account.id)
expect(target_account.reload.followers_count).to eq(target_account.passive_relationships.count)
end
end
context 'both accounts are distant' do
describe 'perform' do
it 'calls UnfollowFollowWorker' do
@@ -83,6 +95,7 @@ describe MoveWorker do
include_examples 'user note handling'
include_examples 'block and mute handling'
include_examples 'followers count handling'
end
end
@@ -97,6 +110,7 @@ describe MoveWorker do
include_examples 'user note handling'
include_examples 'block and mute handling'
include_examples 'followers count handling'
end
end
@@ -112,6 +126,7 @@ describe MoveWorker do
include_examples 'user note handling'
include_examples 'block and mute handling'
include_examples 'followers count handling'
it 'does not fail when a local user is already following both accounts' do
double_follower = Fabricate(:account)