Merge pull request #3453 from evazion/fix-3450

Fix #3450: Aliased tags show up under translated tags.
This commit is contained in:
Albert Yi
2017-12-25 13:20:20 -08:00
committed by GitHub
2 changed files with 14 additions and 1 deletions

View File

@@ -83,7 +83,9 @@ module Sources
# Given a tag from the source site, should return an array of corresponding Danbooru tags.
def translate_tag(untranslated_tag)
translated_tags = Tag.where(name: WikiPage.active.other_names_equal(untranslated_tag).uniq.select(:title))
translated_tag_names = WikiPage.active.other_names_equal(untranslated_tag).uniq.pluck(:title)
translated_tag_names = TagAlias.to_aliased(translated_tag_names)
translated_tags = Tag.where(name: translated_tag_names)
if translated_tags.empty?
normalized_name = TagAlias.to_aliased([Tag.normalize_name(untranslated_tag)])