dtext: refactor parsing of embedded BUR pseudo tags.

This commit is contained in:
evazion
2020-02-22 01:37:12 -06:00
parent ca1492c8ca
commit c1f7b76bdb
5 changed files with 13 additions and 44 deletions

View File

@@ -137,14 +137,6 @@ class BulkUpdateRequest < ApplicationRecord
include ApprovalMethods
include ValidationMethods
concerning :EmbeddedText do
class_methods do
def embedded_pattern
/\[bur:(?<id>\d+)\]/m
end
end
end
def editable?(user)
user_id == user.id || user.is_builder?
end

View File

@@ -33,14 +33,6 @@ class TagAlias < TagRelationship
include ApprovalMethods
include ForumMethods
concerning :EmbeddedText do
class_methods do
def embedded_pattern
/\[ta:(?<id>\d+)\]/m
end
end
end
def self.to_aliased(names)
names = Array(names).map(&:to_s)
return [] if names.empty?

View File

@@ -191,14 +191,6 @@ class TagImplication < TagRelationship
include ValidationMethods
include ApprovalMethods
concerning :EmbeddedText do
class_methods do
def embedded_pattern
/\[ti:(?<id>\d+)\]/m
end
end
end
def reload(options = {})
flush_cache
super

View File

@@ -177,14 +177,6 @@ class TagRelationship < ApplicationRecord
end
end
concerning :EmbeddedText do
class_methods do
def embedded_pattern
raise NotImplementedError
end
end
end
def antecedent_and_consequent_are_different
if antecedent_name == consequent_name
errors[:base] << "Cannot alias or implicate a tag to itself"