forked from e621ng/e621ng
[BUR] Move "duplicate of" text location
This commit is contained in:
parent
aaf1423ef8
commit
42c59ac384
@ -59,10 +59,10 @@ class BulkUpdateRequestImporter
|
|||||||
tokens.map do |token|
|
tokens.map do |token|
|
||||||
case token[0]
|
case token[0]
|
||||||
when :create_alias
|
when :create_alias
|
||||||
comment = "# duplicate of #{token[3]}" if token[3].present?
|
comment = "# #{token[3]}" if token[3].present?
|
||||||
"alias #{token[1]} -> #{token[2]} #{comment}".strip
|
"alias #{token[1]} -> #{token[2]} #{comment}".strip
|
||||||
when :create_implication
|
when :create_implication
|
||||||
comment = "# duplicate of #{token[3]}" if token[3].present?
|
comment = "# #{token[3]}" if token[3].present?
|
||||||
"implicate #{token[1]} -> #{token[2]} #{comment}".strip
|
"implicate #{token[1]} -> #{token[2]} #{comment}".strip
|
||||||
when :remove_alias
|
when :remove_alias
|
||||||
comment = "# missing" if token[3] == false
|
comment = "# missing" if token[3] == false
|
||||||
@ -88,10 +88,10 @@ class BulkUpdateRequestImporter
|
|||||||
def validate_alias(token)
|
def validate_alias(token)
|
||||||
tag_alias = TagAlias.duplicate_relevant.find_by(antecedent_name: token[1], consequent_name: token[2])
|
tag_alias = TagAlias.duplicate_relevant.find_by(antecedent_name: token[1], consequent_name: token[2])
|
||||||
if tag_alias.present? && tag_alias.has_transitives
|
if tag_alias.present? && tag_alias.has_transitives
|
||||||
return [nil, "alias ##{tag_alias.id}, has blocking transitive relationships, cannot be applied through BUR"]
|
return [nil, "duplicate of alias ##{tag_alias.id}; has blocking transitive relationships, cannot be applied through BUR"]
|
||||||
end
|
end
|
||||||
return [nil, "alias ##{tag_alias.id}"] unless tag_alias.nil?
|
return [nil, "duplicate of alias ##{tag_alias.id}"] unless tag_alias.nil?
|
||||||
tag_alias = TagAlias.new(:forum_topic_id => forum_id, :status => "pending", :antecedent_name => token[1], :consequent_name => token[2])
|
tag_alias = TagAlias.new(forum_topic_id: forum_id, status: "pending", antecedent_name: token[1], consequent_name: token[2])
|
||||||
unless tag_alias.valid?
|
unless tag_alias.valid?
|
||||||
return ["Error: #{tag_alias.errors.full_messages.join("; ")} (create alias #{tag_alias.antecedent_name} -> #{tag_alias.consequent_name})", nil]
|
return ["Error: #{tag_alias.errors.full_messages.join("; ")} (create alias #{tag_alias.antecedent_name} -> #{tag_alias.consequent_name})", nil]
|
||||||
end
|
end
|
||||||
@ -103,8 +103,8 @@ class BulkUpdateRequestImporter
|
|||||||
|
|
||||||
def validate_implication(token)
|
def validate_implication(token)
|
||||||
tag_implication = TagImplication.duplicate_relevant.find_by(antecedent_name: token[1], consequent_name: token[2])
|
tag_implication = TagImplication.duplicate_relevant.find_by(antecedent_name: token[1], consequent_name: token[2])
|
||||||
return [nil, "implication ##{tag_implication.id}"] unless tag_implication.nil?
|
return [nil, "duplicate of implication ##{tag_implication.id}"] unless tag_implication.nil?
|
||||||
tag_implication = TagImplication.new(:forum_topic_id => forum_id, :status => "pending", :antecedent_name => token[1], :consequent_name => token[2])
|
tag_implication = TagImplication.new(forum_topic_id: forum_id, status: "pending", antecedent_name: token[1], consequent_name: token[2])
|
||||||
unless tag_implication.valid?
|
unless tag_implication.valid?
|
||||||
return ["Error: #{tag_implication.errors.full_messages.join("; ")} (create implication #{tag_implication.antecedent_name} -> #{tag_implication.consequent_name})", nil]
|
return ["Error: #{tag_implication.errors.full_messages.join("; ")} (create implication #{tag_implication.antecedent_name} -> #{tag_implication.consequent_name})", nil]
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user