Skip to content

Commit

Permalink
Use composable query in Status.without_replies scope (mastodon#30086)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjankowski committed Apr 29, 2024
1 parent 95e9de5 commit ac7f4d5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/models/status.rb
Expand Up @@ -106,7 +106,9 @@ class Status < ApplicationRecord
scope :remote, -> { where(local: false).where.not(uri: nil) }
scope :local, -> { where(local: true).or(where(uri: nil)) }
scope :with_accounts, ->(ids) { where(id: ids).includes(:account) }
scope :without_replies, -> { where('statuses.reply = FALSE OR statuses.in_reply_to_account_id = statuses.account_id') }
scope :without_replies, -> { not_reply.or(reply_to_account) }
scope :not_reply, -> { where(reply: false) }
scope :reply_to_account, -> { where(arel_table[:in_reply_to_account_id].eq arel_table[:account_id]) }
scope :without_reblogs, -> { where(statuses: { reblog_of_id: nil }) }
scope :tagged_with, ->(tag_ids) { joins(:statuses_tags).where(statuses_tags: { tag_id: tag_ids }) }
scope :not_excluded_by_account, ->(account) { where.not(account_id: account.excluded_from_timeline_account_ids) }
Expand Down

0 comments on commit ac7f4d5

Please sign in to comment.