This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
class NicoTagVersion < ApplicationRecord
|
||||
include VersionRecord
|
||||
|
||||
belongs_to :tag
|
||||
|
||||
validates :name, presence: true
|
||||
end
|
||||
@@ -157,7 +157,6 @@ class Tag < ApplicationRecord
|
||||
target_tag => Tag
|
||||
|
||||
affected_post_ids = Set.new
|
||||
affected_tag_ids = Set.new
|
||||
|
||||
Tag.transaction do
|
||||
Array(source_tags).compact.uniq.each do |source_tag|
|
||||
@@ -181,7 +180,7 @@ class Tag < ApplicationRecord
|
||||
end
|
||||
|
||||
source_tag.discard!
|
||||
record_tag_discard!(source_tag, current_by_user: nil)
|
||||
TagVersioning.record!(source_tag, event_type: :discard, created_by_user:)
|
||||
|
||||
if source_tag.nico?
|
||||
source_tag_name.discard!
|
||||
@@ -190,7 +189,7 @@ class Tag < ApplicationRecord
|
||||
updated_at: Time.current)
|
||||
end
|
||||
|
||||
record_tag_version!(target_tag, event_type: :update, created_by_user: nil)
|
||||
TagVersioning.record!(target_tag, event_type: :update, created_by_user:)
|
||||
end
|
||||
|
||||
Post.where(id: affected_post_ids.to_a).find_each do |post|
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
class TagName < ApplicationRecord
|
||||
include MyDiscard
|
||||
|
||||
default_scope -> { kept }
|
||||
|
||||
has_one :tag
|
||||
has_one :wiki_page
|
||||
|
||||
|
||||
@@ -8,8 +8,7 @@ class TagVersion < ApplicationRecord
|
||||
character: 'character',
|
||||
general: 'general',
|
||||
material: 'material',
|
||||
meta: 'meta',
|
||||
nico: 'nico' }, validate: true
|
||||
meta: 'meta' }, validate: true
|
||||
|
||||
validates :name, presence: true
|
||||
validates :category, presence: true
|
||||
|
||||
Reference in New Issue
Block a user