Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `.prettierignore`: Upstream added a line at the end of the file, while glitch-soc had its own extra lines. Took upstream's change. - `CONTRIBUTING.md`: We have our custom CONTRIBUTING.md quoting upstream. Upstream made changes. Ported upstream changes. - `app/controllers/application_controller.rb`: Upstream made code style changes in a method that is entirely replaced in glitch-soc. Ignored the change. - `app/models/account.rb`: Code style changes textually close to glitch-soc-specific changes. Ported upstream changes. - `lib/sanitize_ext/sanitize_config.rb`: Upstream code style changes. Ignored them.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe PublicFeed, type: :model do
|
||||
@@ -11,7 +13,7 @@ RSpec.describe PublicFeed, type: :model do
|
||||
private_status = Fabricate(:status, visibility: :private)
|
||||
|
||||
expect(subject).to include(public_status.id)
|
||||
expect(subject).not_to include(private_status.id)
|
||||
expect(subject).to_not include(private_status.id)
|
||||
end
|
||||
|
||||
it 'does not include replies' do
|
||||
@@ -19,7 +21,7 @@ RSpec.describe PublicFeed, type: :model do
|
||||
reply = Fabricate(:status, in_reply_to_id: status.id)
|
||||
|
||||
expect(subject).to include(status.id)
|
||||
expect(subject).not_to include(reply.id)
|
||||
expect(subject).to_not include(reply.id)
|
||||
end
|
||||
|
||||
it 'does not include boosts' do
|
||||
@@ -27,7 +29,7 @@ RSpec.describe PublicFeed, type: :model do
|
||||
boost = Fabricate(:status, reblog_of_id: status.id)
|
||||
|
||||
expect(subject).to include(status.id)
|
||||
expect(subject).not_to include(boost.id)
|
||||
expect(subject).to_not include(boost.id)
|
||||
end
|
||||
|
||||
it 'filters out silenced accounts' do
|
||||
@@ -36,10 +38,12 @@ RSpec.describe PublicFeed, type: :model do
|
||||
silenced_status = Fabricate(:status, account: silenced_account)
|
||||
|
||||
expect(subject).to include(status.id)
|
||||
expect(subject).not_to include(silenced_status.id)
|
||||
expect(subject).to_not include(silenced_status.id)
|
||||
end
|
||||
|
||||
context 'without local_only option' do
|
||||
subject { described_class.new(viewer).get(20).map(&:id) }
|
||||
|
||||
let(:viewer) { nil }
|
||||
|
||||
let!(:local_account) { Fabricate(:account, domain: nil) }
|
||||
@@ -48,8 +52,6 @@ RSpec.describe PublicFeed, type: :model do
|
||||
let!(:remote_status) { Fabricate(:status, account: remote_account) }
|
||||
let!(:local_only_status) { Fabricate(:status, account: local_account, local_only: true) }
|
||||
|
||||
subject { described_class.new(viewer).get(20).map(&:id) }
|
||||
|
||||
context 'without a viewer' do
|
||||
let(:viewer) { nil }
|
||||
|
||||
@@ -128,20 +130,20 @@ RSpec.describe PublicFeed, type: :model do
|
||||
end
|
||||
|
||||
context 'with a local_only option set' do
|
||||
subject { described_class.new(viewer, local: true).get(20).map(&:id) }
|
||||
|
||||
let!(:local_account) { Fabricate(:account, domain: nil) }
|
||||
let!(:remote_account) { Fabricate(:account, domain: 'test.com') }
|
||||
let!(:local_status) { Fabricate(:status, account: local_account) }
|
||||
let!(:remote_status) { Fabricate(:status, account: remote_account) }
|
||||
let!(:local_only_status) { Fabricate(:status, account: local_account, local_only: true) }
|
||||
|
||||
subject { described_class.new(viewer, local: true).get(20).map(&:id) }
|
||||
|
||||
context 'without a viewer' do
|
||||
let(:viewer) { nil }
|
||||
|
||||
it 'does not include remote instances statuses' do
|
||||
expect(subject).to include(local_status.id)
|
||||
expect(subject).not_to include(remote_status.id)
|
||||
expect(subject).to_not include(remote_status.id)
|
||||
end
|
||||
|
||||
it 'does not include local-only statuses' do
|
||||
@@ -154,13 +156,13 @@ RSpec.describe PublicFeed, type: :model do
|
||||
|
||||
it 'does not include remote instances statuses' do
|
||||
expect(subject).to include(local_status.id)
|
||||
expect(subject).not_to include(remote_status.id)
|
||||
expect(subject).to_not include(remote_status.id)
|
||||
end
|
||||
|
||||
it 'is not affected by personal domain blocks' do
|
||||
viewer.block_domain!('test.com')
|
||||
expect(subject).to include(local_status.id)
|
||||
expect(subject).not_to include(remote_status.id)
|
||||
expect(subject).to_not include(remote_status.id)
|
||||
end
|
||||
|
||||
it 'includes local-only statuses' do
|
||||
@@ -170,18 +172,18 @@ RSpec.describe PublicFeed, type: :model do
|
||||
end
|
||||
|
||||
context 'with a remote_only option set' do
|
||||
subject { described_class.new(viewer, remote: true).get(20).map(&:id) }
|
||||
|
||||
let!(:local_account) { Fabricate(:account, domain: nil) }
|
||||
let!(:remote_account) { Fabricate(:account, domain: 'test.com') }
|
||||
let!(:local_status) { Fabricate(:status, account: local_account) }
|
||||
let!(:remote_status) { Fabricate(:status, account: remote_account) }
|
||||
|
||||
subject { described_class.new(viewer, remote: true).get(20).map(&:id) }
|
||||
|
||||
context 'without a viewer' do
|
||||
let(:viewer) { nil }
|
||||
|
||||
it 'does not include local instances statuses' do
|
||||
expect(subject).not_to include(local_status.id)
|
||||
expect(subject).to_not include(local_status.id)
|
||||
expect(subject).to include(remote_status.id)
|
||||
end
|
||||
end
|
||||
@@ -190,25 +192,25 @@ RSpec.describe PublicFeed, type: :model do
|
||||
let(:viewer) { Fabricate(:account, username: 'viewer') }
|
||||
|
||||
it 'does not include local instances statuses' do
|
||||
expect(subject).not_to include(local_status.id)
|
||||
expect(subject).to_not include(local_status.id)
|
||||
expect(subject).to include(remote_status.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with an account passed in' do
|
||||
subject { described_class.new(@account).get(20).map(&:id) }
|
||||
|
||||
before do
|
||||
@account = Fabricate(:account)
|
||||
end
|
||||
|
||||
subject { described_class.new(@account).get(20).map(&:id) }
|
||||
|
||||
it 'excludes statuses from accounts blocked by the account' do
|
||||
blocked = Fabricate(:account)
|
||||
@account.block!(blocked)
|
||||
blocked_status = Fabricate(:status, account: blocked)
|
||||
|
||||
expect(subject).not_to include(blocked_status.id)
|
||||
expect(subject).to_not include(blocked_status.id)
|
||||
end
|
||||
|
||||
it 'excludes statuses from accounts who have blocked the account' do
|
||||
@@ -216,7 +218,7 @@ RSpec.describe PublicFeed, type: :model do
|
||||
blocker.block!(@account)
|
||||
blocked_status = Fabricate(:status, account: blocker)
|
||||
|
||||
expect(subject).not_to include(blocked_status.id)
|
||||
expect(subject).to_not include(blocked_status.id)
|
||||
end
|
||||
|
||||
it 'excludes statuses from accounts muted by the account' do
|
||||
@@ -224,7 +226,7 @@ RSpec.describe PublicFeed, type: :model do
|
||||
@account.mute!(muted)
|
||||
muted_status = Fabricate(:status, account: muted)
|
||||
|
||||
expect(subject).not_to include(muted_status.id)
|
||||
expect(subject).to_not include(muted_status.id)
|
||||
end
|
||||
|
||||
it 'excludes statuses from accounts from personally blocked domains' do
|
||||
@@ -232,7 +234,7 @@ RSpec.describe PublicFeed, type: :model do
|
||||
@account.block_domain!(blocked.domain)
|
||||
blocked_status = Fabricate(:status, account: blocked)
|
||||
|
||||
expect(subject).not_to include(blocked_status.id)
|
||||
expect(subject).to_not include(blocked_status.id)
|
||||
end
|
||||
|
||||
context 'with language preferences' do
|
||||
@@ -244,7 +246,7 @@ RSpec.describe PublicFeed, type: :model do
|
||||
|
||||
expect(subject).to include(en_status.id)
|
||||
expect(subject).to include(es_status.id)
|
||||
expect(subject).not_to include(fr_status.id)
|
||||
expect(subject).to_not include(fr_status.id)
|
||||
end
|
||||
|
||||
it 'includes all languages when user does not have a setting' do
|
||||
|
Reference in New Issue
Block a user