From 3e43cd095c5e1ad20bbb70d0e8d2cc09fff776f1 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 8 Jan 2024 10:26:14 -0500 Subject: [PATCH] Remove unused scope `Announcement.without_muted` (#28645) --- app/models/announcement.rb | 1 - spec/models/announcement_spec.rb | 16 ---------------- 2 files changed, 17 deletions(-) diff --git a/app/models/announcement.rb b/app/models/announcement.rb index 00529766a4..cbcaef3daa 100644 --- a/app/models/announcement.rb +++ b/app/models/announcement.rb @@ -20,7 +20,6 @@ class Announcement < ApplicationRecord scope :unpublished, -> { where(published: false) } scope :published, -> { where(published: true) } - scope :without_muted, ->(account) { joins("LEFT OUTER JOIN announcement_mutes ON announcement_mutes.announcement_id = announcements.id AND announcement_mutes.account_id = #{account.id}").where(announcement_mutes: { id: nil }) } scope :chronological, -> { order(coalesced_chronology_timestamps.asc) } scope :reverse_chronological, -> { order(coalesced_chronology_timestamps.desc) } diff --git a/spec/models/announcement_spec.rb b/spec/models/announcement_spec.rb index e37b81a52e..c016a316cd 100644 --- a/spec/models/announcement_spec.rb +++ b/spec/models/announcement_spec.rb @@ -25,22 +25,6 @@ describe Announcement do end end - describe '#without_muted' do - let!(:announcement) { Fabricate(:announcement) } - let(:account) { Fabricate(:account) } - let(:muted_announcement) { Fabricate(:announcement) } - - before do - Fabricate(:announcement_mute, account: account, announcement: muted_announcement) - end - - it 'returns the announcements not muted by the account' do - results = described_class.without_muted(account) - expect(results).to include(announcement) - expect(results).to_not include(muted_announcement) - end - end - context 'with timestamped announcements' do let!(:adam_announcement) { Fabricate(:announcement, starts_at: 100.days.ago, scheduled_at: 10.days.ago, published_at: 10.days.ago, ends_at: 5.days.from_now) } let!(:brenda_announcement) { Fabricate(:announcement, starts_at: 10.days.ago, scheduled_at: 100.days.ago, published_at: 10.days.ago, ends_at: 5.days.from_now) }