Fix #4424: Cross-category alias incorrectly changes destination category.

The rule now is that if one of the tags is a general tag then its
category will be changed to match the other tag.
This commit is contained in:
evazion
2020-04-27 13:57:19 -05:00
parent 182e68cfe0
commit 47f233003c
2 changed files with 33 additions and 14 deletions

View File

@@ -91,8 +91,10 @@ class TagAlias < TagRelationship
end
def ensure_category_consistency
if antecedent_tag.category != consequent_tag.category && antecedent_tag.category != Tag.categories.general
consequent_tag.update_attribute(:category, antecedent_tag.category)
if antecedent_tag.category == Tag.categories.general && consequent_tag.category != Tag.categories.general
antecedent_tag.update!(category: consequent_tag.category)
elsif consequent_tag.category == Tag.categories.general && antecedent_tag.category != Tag.categories.general
consequent_tag.update!(category: antecedent_tag.category)
end
end