Skip to content
Extraits de code Groupes Projets
Valider 198a9a4f rédigé par Akihiko Odaki's avatar Akihiko Odaki Validation de Eugen Rochko
Parcourir les fichiers

Remove local_only scope in Status (#4977)

parent ec36df97
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -70,7 +70,6 @@ class Status < ApplicationRecord ...@@ -70,7 +70,6 @@ class Status < ApplicationRecord
scope :without_reblogs, -> { where('statuses.reblog_of_id IS NULL') } scope :without_reblogs, -> { where('statuses.reblog_of_id IS NULL') }
scope :with_public_visibility, -> { where(visibility: :public) } scope :with_public_visibility, -> { where(visibility: :public) }
scope :tagged_with, ->(tag) { joins(:statuses_tags).where(statuses_tags: { tag_id: tag }) } scope :tagged_with, ->(tag) { joins(:statuses_tags).where(statuses_tags: { tag_id: tag }) }
scope :local_only, -> { left_outer_joins(:account).where(accounts: { domain: nil }) }
scope :excluding_silenced_accounts, -> { left_outer_joins(:account).where(accounts: { silenced: false }) } scope :excluding_silenced_accounts, -> { left_outer_joins(:account).where(accounts: { silenced: false }) }
scope :including_silenced_accounts, -> { left_outer_joins(:account).where(accounts: { silenced: true }) } scope :including_silenced_accounts, -> { left_outer_joins(:account).where(accounts: { silenced: true }) }
scope :not_excluded_by_account, ->(account) { where.not(account_id: account.excluded_from_timeline_account_ids) } scope :not_excluded_by_account, ->(account) { where.not(account_id: account.excluded_from_timeline_account_ids) }
...@@ -221,7 +220,7 @@ class Status < ApplicationRecord ...@@ -221,7 +220,7 @@ class Status < ApplicationRecord
private private
def timeline_scope(local_only = false) def timeline_scope(local_only = false)
starting_scope = local_only ? Status.local_only : Status starting_scope = local_only ? Status.local : Status
starting_scope starting_scope
.with_public_visibility .with_public_visibility
.without_reblogs .without_reblogs
......
...@@ -173,19 +173,6 @@ RSpec.describe Status, type: :model do ...@@ -173,19 +173,6 @@ RSpec.describe Status, type: :model do
end end
end end
describe '.local_only' do
it 'returns only statuses from local accounts' do
local_account = Fabricate(:account, domain: nil)
remote_account = Fabricate(:account, domain: 'test.com')
local_status = Fabricate(:status, account: local_account)
remote_status = Fabricate(:status, account: remote_account)
results = described_class.local_only
expect(results).to include(local_status)
expect(results).not_to include(remote_status)
end
end
describe '.as_home_timeline' do describe '.as_home_timeline' do
let(:account) { Fabricate(:account) } let(:account) { Fabricate(:account) }
let(:followed) { Fabricate(:account) } let(:followed) { Fabricate(:account) }
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter