From f2e9f4303e5e91bc05be771506027c0eb1850ccf Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Sat, 11 Jan 2020 17:07:08 -0600 Subject: remove duplicate posts in gallery mode --- app/models/status.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/models') diff --git a/app/models/status.rb b/app/models/status.rb index 5d257ba6c..ccc7755be 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -122,7 +122,7 @@ class Status < ApplicationRecord scope :search_filtered_by_account, ->(account_id) { where("tsv @@ (SELECT tsquery_union(websearch_to_tsquery('fedi', phrase)) FROM custom_filters WHERE account_id = ? AND is_enabled)", account_id) } scope :search_not_filtered_by_account, ->(account_id) { where.not("tsv @@ (SELECT tsquery_union(websearch_to_tsquery('fedi', phrase)) FROM custom_filters WHERE account_id = ? AND is_enabled)", account_id) } - scope :with_media, -> { joins(:media_attachments).select('statuses.*') } + scope :with_media, -> { joins(:media_attachments).select('statuses.*').distinct(:id) } scope :not_missing_media_desc, -> { left_outer_joins(:media_attachments).select('statuses.*').where('media_attachments.id IS NULL OR media_attachments.description IS NOT NULL') } scope :only_followers_of, ->(account) { where(account: [account] + account.following) } -- cgit