Add not_featured_by
scope to Tag (#28815)
This commit is contained in:
parent
1d3ecd3fba
commit
650c548c31
4 changed files with 23 additions and 6 deletions
|
@ -53,6 +53,8 @@ class Tag < ApplicationRecord
|
|||
scope :listable, -> { where(listable: [true, nil]) }
|
||||
scope :trendable, -> { Setting.trendable_by_default ? where(trendable: [true, nil]) : where(trendable: true) }
|
||||
scope :not_trendable, -> { where(trendable: false) }
|
||||
scope :suggestions_for_account, ->(account) { recently_used(account).not_featured_by(account) }
|
||||
scope :not_featured_by, ->(account) { where.not(id: account.featured_tags.select(:tag_id)) }
|
||||
scope :recently_used, lambda { |account|
|
||||
joins(:statuses)
|
||||
.where(statuses: { id: account.statuses.select(:id).limit(RECENT_STATUS_LIMIT) })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue