tags: exclude deprecated tags from related tags list.

Don't show deprecated tags in the related tags or translated tags lists
when editing a post. It doesn't make sense to recommended adding tags
that can't be added to the post.
This commit is contained in:
evazion
2022-04-13 03:02:44 -05:00
parent e1c9a7d525
commit 15a0fd604b
4 changed files with 5 additions and 3 deletions

View File

@@ -22,6 +22,8 @@ class Tag < ApplicationRecord
scope :empty, -> { where("tags.post_count <= 0") }
scope :nonempty, -> { where("tags.post_count > 0") }
scope :deprecated, -> { where(is_deprecated: true) }
scope :undeprecated, -> { where(is_deprecated: false) }
module ApiMethods
def to_legacy_json

View File

@@ -206,7 +206,7 @@ class WikiPage < ApplicationRecord
def tags
titles = DText.parse_wiki_titles(body).uniq
tags = Tag.nonempty.where(name: titles).pluck(:name)
tags = Tag.nonempty.undeprecated.where(name: titles).pluck(:name)
tags += TagAlias.active.where(antecedent_name: titles).pluck(:antecedent_name)
TagAlias.to_aliased(titles & tags)
end