Per-user reblog hiding implementation/fixes/tests
Note that this will only hide/show *future* reblogs by a user, and does nothing to remove/add reblogs that are already in the timeline. I don't think that's a particularly confusing behavior, and it's a lot easier to implement (similar to mutes, I believe).
This commit is contained in:
@ -13,8 +13,20 @@ RSpec.describe FollowService do
|
||||
subject.call(sender, bob.acct)
|
||||
end
|
||||
|
||||
it 'creates a follow request' do
|
||||
expect(FollowRequest.find_by(account: sender, target_account: bob)).to_not be_nil
|
||||
it 'creates a follow request with reblogs' do
|
||||
expect(FollowRequest.find_by(account: sender, target_account: bob, show_reblogs: true)).to_not be_nil
|
||||
end
|
||||
end
|
||||
|
||||
describe 'locked account, no reblogs' do
|
||||
let(:bob) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, locked: true, username: 'bob')).account }
|
||||
|
||||
before do
|
||||
subject.call(sender, bob.acct, reblogs: false)
|
||||
end
|
||||
|
||||
it 'creates a follow request without reblogs' do
|
||||
expect(FollowRequest.find_by(account: sender, target_account: bob, show_reblogs: false)).to_not be_nil
|
||||
end
|
||||
end
|
||||
|
||||
@ -25,8 +37,22 @@ RSpec.describe FollowService do
|
||||
subject.call(sender, bob.acct)
|
||||
end
|
||||
|
||||
it 'creates a following relation' do
|
||||
it 'creates a following relation with reblogs' do
|
||||
expect(sender.following?(bob)).to be true
|
||||
expect(sender.muting_reblogs?(bob)).to be false
|
||||
end
|
||||
end
|
||||
|
||||
describe 'unlocked account, no reblogs' do
|
||||
let(:bob) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob')).account }
|
||||
|
||||
before do
|
||||
subject.call(sender, bob.acct, reblogs: false)
|
||||
end
|
||||
|
||||
it 'creates a following relation without reblogs' do
|
||||
expect(sender.following?(bob)).to be true
|
||||
expect(sender.muting_reblogs?(bob)).to be true
|
||||
end
|
||||
end
|
||||
|
||||
@ -42,6 +68,32 @@ RSpec.describe FollowService do
|
||||
expect(sender.following?(bob)).to be true
|
||||
end
|
||||
end
|
||||
|
||||
describe 'already followed account, turning reblogs off' do
|
||||
let(:bob) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob')).account }
|
||||
|
||||
before do
|
||||
sender.follow!(bob, reblogs: true)
|
||||
subject.call(sender, bob.acct, reblogs: false)
|
||||
end
|
||||
|
||||
it 'disables reblogs' do
|
||||
expect(sender.muting_reblogs?(bob)).to be true
|
||||
end
|
||||
end
|
||||
|
||||
describe 'already followed account, turning reblogs on' do
|
||||
let(:bob) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob')).account }
|
||||
|
||||
before do
|
||||
sender.follow!(bob, reblogs: false)
|
||||
subject.call(sender, bob.acct, reblogs: true)
|
||||
end
|
||||
|
||||
it 'disables reblogs' do
|
||||
expect(sender.muting_reblogs?(bob)).to be false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'remote OStatus account' do
|
||||
|
@ -48,6 +48,26 @@ RSpec.describe NotifyService do
|
||||
is_expected.to_not change(Notification, :count)
|
||||
end
|
||||
|
||||
describe 'reblogs' do
|
||||
let(:status) { Fabricate(:status, account: Fabricate(:account)) }
|
||||
let(:activity) { Fabricate(:status, account: sender, reblog: status) }
|
||||
|
||||
it 'shows reblogs by default' do
|
||||
recipient.follow!(sender)
|
||||
is_expected.to change(Notification, :count)
|
||||
end
|
||||
|
||||
it 'shows reblogs when explicitly enabled' do
|
||||
recipient.follow!(sender, reblogs: true)
|
||||
is_expected.to change(Notification, :count)
|
||||
end
|
||||
|
||||
it 'hides reblogs when disabled' do
|
||||
recipient.follow!(sender, reblogs: false)
|
||||
is_expected.to_not change(Notification, :count)
|
||||
end
|
||||
end
|
||||
|
||||
context do
|
||||
let(:asshole) { Fabricate(:account, username: 'asshole') }
|
||||
let(:reply_to) { Fabricate(:status, account: asshole) }
|
||||
|
Reference in New Issue
Block a user