about summary refs log tree commit diff
path: root/app/models/tag.rb
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-10-10 17:26:08 +0200
committerThibaut Girka <thib@sitedethib.com>2019-10-10 17:26:08 +0200
commit61631f475163c5640a78ff66f0ac6c053cda2f84 (patch)
tree78920c924924b76872d420c27a8c62fb1b7f6bb7 /app/models/tag.rb
parentbc0399d54dde2ad058a8382fc3edbe5506a92985 (diff)
parenta57ac0723f5918b12838da8373d51706cb461a4e (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- README.md
- app/javascript/styles/mastodon/components.scss
  conflicts caused by image URLs being different
- app/models/status.rb
  as_home_timeline removed, kept glitch-soc-only as_direct_timeline
- app/views/statuses/_simple_status.html.haml
- config/locales/en.yml
  some strings were changed upstream
- spec/models/status_spec.rb
  as_home_timeline removed, kept glitch-soc-only as_direct_timeline
Diffstat (limited to 'app/models/tag.rb')
-rw-r--r--app/models/tag.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/tag.rb b/app/models/tag.rb
index 82786daa8..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}%")) }
@@ -76,7 +77,7 @@ class Tag < ApplicationRecord
   alias listable? listable
 
   def trendable
-    boolean_with_default('trendable', false)
+    boolean_with_default('trendable', Setting.trendable_by_default)
   end
 
   alias trendable? trendable