about summary refs log tree commit diff
path: root/app/models/tag.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-08-07 10:01:55 +0200
committerGitHub <noreply@github.com>2019-08-07 10:01:55 +0200
commitac33f1aedd9a6c72c6c176afb1f5d62a1ce5d44d (patch)
tree9bf21d9eb62390f87da145ff880d13a55e9503a7 /app/models/tag.rb
parent5e35aa82802b09a63d4625fa9c1837ad75178553 (diff)
Fix account tags not being saved correctly (#11507)
* Fix account tags not being saved correctly

Regression from f371b32

Fix Tag#discoverable not returning tags where listable is nil instead of true

Add notice when saving hashtags in admin UI

Change public hashtag and directory pages to return 404 for forbidden tags

* Remove unused locale string
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 6a02581fa..e2fe91da1 100644
--- a/app/models/tag.rb
+++ b/app/models/tag.rb
@@ -31,7 +31,8 @@ class Tag < ApplicationRecord
 
   scope :reviewed, -> { where.not(reviewed_at: nil) }
   scope :pending_review, -> { where(reviewed_at: nil).where.not(requested_review_at: nil) }
-  scope :discoverable, -> { where.not(listable: false).joins(:account_tag_stat).where(AccountTagStat.arel_table[:accounts_count].gt(0)).order(Arel.sql('account_tag_stats.accounts_count desc')) }
+  scope :usable, -> { where(usable: [true, nil]) }
+  scope :discoverable, -> { where(listable: [true, nil]).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')) }
 
   delegate :accounts_count,