0
0
Fork 0

Use PostgreSQL inheritance for blocks and mutes (#2520)

This commit is contained in:
Akihiko Odaki 2017-04-30 07:27:31 +09:00 committed by Eugen Rochko
parent f48cb3eb17
commit 5135d609b7
7 changed files with 43 additions and 12 deletions

View file

@ -193,9 +193,9 @@ RSpec.describe Account, type: :model do
describe '#excluded_from_timeline_account_ids' do
it 'includes account ids of blockings, blocked_bys and mutes' do
account = Fabricate(:account)
block = Fabricate(:block, account: account)
mute = Fabricate(:mute, account: account)
block_by = Fabricate(:block, target_account: account)
block = Fabricate(:block, account: account, block: true)
mute = Fabricate(:mute, account: account, block: false)
block_by = Fabricate(:block, target_account: account, block: true)
results = account.excluded_from_timeline_account_ids
expect(results.size).to eq 3

View file

@ -226,7 +226,7 @@ RSpec.describe Status, type: :model do
it 'excludes statuses from accounts blocked by the account' do
blocked = Fabricate(:account)
Fabricate(:block, account: @account, target_account: blocked)
Fabricate(:block, account: @account, target_account: blocked, block: true)
blocked_status = Fabricate(:status, account: blocked)
results = Status.as_public_timeline(@account)
@ -235,7 +235,7 @@ RSpec.describe Status, type: :model do
it 'excludes statuses from accounts who have blocked the account' do
blocked = Fabricate(:account)
Fabricate(:block, account: blocked, target_account: @account)
Fabricate(:block, account: blocked, target_account: @account, block: true)
blocked_status = Fabricate(:status, account: blocked)
results = Status.as_public_timeline(@account)
@ -244,7 +244,7 @@ RSpec.describe Status, type: :model do
it 'excludes statuses from accounts muted by the account' do
muted = Fabricate(:account)
Fabricate(:mute, account: @account, target_account: muted)
Fabricate(:mute, account: @account, target_account: muted, block: false)
muted_status = Fabricate(:status, account: muted)
results = Status.as_public_timeline(@account)