Skip to content
Snippets Groups Projects
Commit 04c3599a authored by Takeshi Umeda's avatar Takeshi Umeda
Browse files

Does not list tags with an underscore at the end

parent 72037c9b
No related branches found
No related tags found
No related merge requests found
...@@ -50,6 +50,8 @@ class Tag < ApplicationRecord ...@@ -50,6 +50,8 @@ class Tag < ApplicationRecord
:decrement_count!, :decrement_count!,
to: :account_tag_stat to: :account_tag_stat
before_save :set_unlistable, if: :force_unlistable?
after_save :save_account_tag_stat after_save :save_account_tag_stat
update_index('tags#tag', :self) update_index('tags#tag', :self)
...@@ -84,6 +86,10 @@ class Tag < ApplicationRecord ...@@ -84,6 +86,10 @@ class Tag < ApplicationRecord
alias trendable? trendable alias trendable? trendable
def force_unlistable?
name.end_with?('_')
end
def requires_review? def requires_review?
reviewed_at.nil? reviewed_at.nil?
end end
...@@ -165,6 +171,10 @@ class Tag < ApplicationRecord ...@@ -165,6 +171,10 @@ class Tag < ApplicationRecord
private private
def set_unlistable
self.listable = false
end
def save_account_tag_stat def save_account_tag_stat
return unless account_tag_stat&.changed? return unless account_tag_stat&.changed?
account_tag_stat.save account_tag_stat.save
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment