BURs: fix remove alias command removing inactive aliases.

Fix the `remove alias` and `remove implication` commands to only remove
active aliases or implications, not pending/deleted/retired ones.
This commit is contained in:
evazion
2019-01-03 16:30:39 -06:00
parent 82b09860f2
commit 886096b47a
2 changed files with 12 additions and 5 deletions

View File

@@ -100,12 +100,12 @@ private
tag_implication.approve!(approver: approver, update_topic: false)
when :remove_alias
tag_alias = TagAlias.where("antecedent_name = ?", token[1]).first
tag_alias = TagAlias.active.find_by(antecedent_name: token[1], consequent_name: token[2])
raise Error, "Alias for #{token[1]} not found" if tag_alias.nil?
tag_alias.reject!(update_topic: false)
when :remove_implication
tag_implication = TagImplication.where("antecedent_name = ? and consequent_name = ?", token[1], token[2]).first
tag_implication = TagImplication.active.find_by(antecedent_name: token[1], consequent_name: token[2])
raise Error, "Implication for #{token[1]} not found" if tag_implication.nil?
tag_implication.reject!(update_topic: false)