From 198a9a4fa42b880cba182d19dcc8edad360a4fbe Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Sun, 17 Sep 2017 12:29:43 +0900 Subject: [PATCH] Remove local_only scope in Status (#4977) --- app/models/status.rb | 3 +-- spec/models/status_spec.rb | 13 ------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/app/models/status.rb b/app/models/status.rb index 514cab2e..8e82c6aa 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -70,7 +70,6 @@ class Status < ApplicationRecord scope :without_reblogs, -> { where('statuses.reblog_of_id IS NULL') } scope :with_public_visibility, -> { where(visibility: :public) } 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 :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) } @@ -221,7 +220,7 @@ class Status < ApplicationRecord private def timeline_scope(local_only = false) - starting_scope = local_only ? Status.local_only : Status + starting_scope = local_only ? Status.local : Status starting_scope .with_public_visibility .without_reblogs diff --git a/spec/models/status_spec.rb b/spec/models/status_spec.rb index 484effd5..f7ee0a60 100644 --- a/spec/models/status_spec.rb +++ b/spec/models/status_spec.rb @@ -173,19 +173,6 @@ RSpec.describe Status, type: :model do 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 let(:account) { Fabricate(:account) } let(:followed) { Fabricate(:account) }