Use composable query in Status.without_replies scope (#30086)
				
					
				
			This commit is contained in:
		
							parent
							
								
									95e9de5777
								
							
						
					
					
						commit
						ac7f4d57bb
					
				@ -106,7 +106,9 @@ class Status < ApplicationRecord
 | 
				
			|||||||
  scope :remote, -> { where(local: false).where.not(uri: nil) }
 | 
					  scope :remote, -> { where(local: false).where.not(uri: nil) }
 | 
				
			||||||
  scope :local,  -> { where(local: true).or(where(uri: nil)) }
 | 
					  scope :local,  -> { where(local: true).or(where(uri: nil)) }
 | 
				
			||||||
  scope :with_accounts, ->(ids) { where(id: ids).includes(:account) }
 | 
					  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 :without_reblogs, -> { where(statuses: { reblog_of_id: nil }) }
 | 
				
			||||||
  scope :tagged_with, ->(tag_ids) { joins(:statuses_tags).where(statuses_tags: { tag_id: tag_ids }) }
 | 
					  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) }
 | 
					  scope :not_excluded_by_account, ->(account) { where.not(account_id: account.excluded_from_timeline_account_ids) }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user