about summary refs log tree commit diff
path: root/app/models/tag.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-10-10 02:22:04 +0200
committerGitHub <noreply@github.com>2019-10-10 02:22:04 +0200
commit915f3712ae7ae44c0cbe50c9694c25e3ee87a540 (patch)
tree9cd778546fbc4bbe076d3a55a9b142f875845eaf /app/models/tag.rb
parent30a28a2eb7bdd39de877ae8171555307986b3e06 (diff)
Fix admin setting to auto-approve hashtags not affecting query (#12130)
Follow-up to #12122
Diffstat (limited to 'app/models/tag.rb')
-rw-r--r--app/models/tag.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/tag.rb b/app/models/tag.rb
index 59445a83b..d3a7e1e6d 100644
--- a/app/models/tag.rb
+++ b/app/models/tag.rb
@@ -37,6 +37,7 @@ class Tag < ApplicationRecord
   scope :pending_review, -> { unreviewed.where.not(requested_review_at: nil) }
   scope :usable, -> { where(usable: [true, nil]) }
   scope :listable, -> { where(listable: [true, nil]) }
+  scope :trendable, -> { Setting.trendable_by_default ? where(trendable: [true, nil]) : where(trendable: true) }
   scope :discoverable, -> { listable.joins(:account_tag_stat).where(AccountTagStat.arel_table[:accounts_count].gt(0)).order(Arel.sql('account_tag_stats.accounts_count desc')) }
   scope :most_used, ->(account) { joins(:statuses).where(statuses: { account: account }).group(:id).order(Arel.sql('count(*) desc')) }
   scope :matches_name, ->(value) { where(arel_table[:name].matches("#{value}%")) }