aliases/implications: don't destroy removed aliases (#4024).
This commit is contained in:
@@ -102,12 +102,12 @@ private
|
||||
when :remove_alias
|
||||
tag_alias = TagAlias.where("antecedent_name = ?", token[1]).first
|
||||
raise Error, "Alias for #{token[1]} not found" if tag_alias.nil?
|
||||
tag_alias.destroy
|
||||
tag_alias.reject!(update_topic: false)
|
||||
|
||||
when :remove_implication
|
||||
tag_implication = TagImplication.where("antecedent_name = ? and consequent_name = ?", token[1], token[2]).first
|
||||
raise Error, "Implication for #{token[1]} not found" if tag_implication.nil?
|
||||
tag_implication.destroy
|
||||
tag_implication.reject!(update_topic: false)
|
||||
|
||||
when :mass_update
|
||||
Delayed::Job.enqueue(Moderator::TagBatchChange.new(token[1], token[2], CurrentUser.id, CurrentUser.ip_addr), :queue => "default")
|
||||
|
||||
@@ -188,11 +188,10 @@ class TagAlias < TagRelationship
|
||||
end
|
||||
end
|
||||
|
||||
def reject!
|
||||
def reject!(update_topic: true)
|
||||
update(status: "deleted")
|
||||
clear_all_cache
|
||||
forum_updater.update(reject_message(CurrentUser.user), "REJECTED")
|
||||
destroy
|
||||
forum_updater.update(reject_message(CurrentUser.user), "REJECTED") if update_topic
|
||||
end
|
||||
|
||||
def wiki_pages_present
|
||||
|
||||
@@ -169,10 +169,9 @@ class TagImplication < TagRelationship
|
||||
delay(:queue => "default").process!(update_topic: update_topic)
|
||||
end
|
||||
|
||||
def reject!
|
||||
def reject!(update_topic: true)
|
||||
update(status: "deleted")
|
||||
forum_updater.update(reject_message(CurrentUser.user), "REJECTED")
|
||||
destroy
|
||||
forum_updater.update(reject_message(CurrentUser.user), "REJECTED") if update_topic
|
||||
end
|
||||
|
||||
def create_mod_action
|
||||
|
||||
@@ -16,6 +16,7 @@ class TagRelationship < ApplicationRecord
|
||||
has_one :consequent_wiki, through: :consequent_tag, source: :wiki_page
|
||||
|
||||
scope :active, ->{where(status: "active")}
|
||||
scope :deleted, ->{where(status: "deleted")}
|
||||
scope :expired, ->{where("created_at < ?", EXPIRY.days.ago)}
|
||||
scope :old, ->{where("created_at >= ? and created_at < ?", EXPIRY.days.ago, EXPIRY_WARNING.days.ago)}
|
||||
scope :pending, ->{where(status: "pending")}
|
||||
|
||||
@@ -1 +1 @@
|
||||
$("#tag-alias-<%= @tag_alias.id %>").remove();
|
||||
location.reload();
|
||||
|
||||
@@ -1 +1 @@
|
||||
$("#tag-implication-<%= @tag_implication.id %>").remove();
|
||||
location.reload();
|
||||
|
||||
Reference in New Issue
Block a user