about summary refs log tree commit diff
path: root/app/models/tag.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/tag.rb')
-rw-r--r--app/models/tag.rb26
1 files changed, 0 insertions, 26 deletions
diff --git a/app/models/tag.rb b/app/models/tag.rb
index b28e2cc18..4f31f796e 100644
--- a/app/models/tag.rb
+++ b/app/models/tag.rb
@@ -11,31 +11,12 @@
 
 class Tag < ApplicationRecord
   has_and_belongs_to_many :statuses
-  has_and_belongs_to_many :accounts
-
-  has_one :account_tag_stat, dependent: :destroy
 
   HASHTAG_NAME_RE = '[[:word:]_]*[[:alpha:]_·][[:word:]_]*'
   HASHTAG_RE = /(?:^|[^\/\)\w])#(#{HASHTAG_NAME_RE})/i
 
   validates :name, presence: true, uniqueness: true, format: { with: /\A#{HASHTAG_NAME_RE}\z/i }
 
-  scope :discoverable, -> { joins(:account_tag_stat).where(AccountTagStat.arel_table[:accounts_count].gt(0)).where(account_tag_stats: { hidden: false }).order(name: :asc) }
-  scope :hidden, -> { where(account_tag_stats: { hidden: true }) }
-
-  delegate :accounts_count,
-           :accounts_count=,
-           :increment_count!,
-           :decrement_count!,
-           :hidden?,
-           to: :account_tag_stat
-
-  after_save :save_account_tag_stat
-
-  def account_tag_stat
-    super || build_account_tag_stat
-  end
-
   def to_param
     name
   end
@@ -62,11 +43,4 @@ class Tag < ApplicationRecord
       Tag.where('lower(name) like lower(?)', pattern).order(:name).limit(limit)
     end
   end
-
-  private
-
-  def save_account_tag_stat
-    return unless account_tag_stat&.changed?
-    account_tag_stat.save
-  end
 end