| @@ -180,7 +180,6 @@ class Tag < ApplicationRecord | |||||
| end | end | ||||
| source_tag.discard! | source_tag.discard! | ||||
| TagVersioning.record!(source_tag, event_type: :discard, created_by_user:) | |||||
| if source_tag.nico? | if source_tag.nico? | ||||
| source_tag_name.discard! | source_tag_name.discard! | ||||
| @@ -189,6 +188,7 @@ class Tag < ApplicationRecord | |||||
| updated_at: Time.current) | updated_at: Time.current) | ||||
| end | end | ||||
| TagVersioning.record!(source_tag, event_type: :discard, created_by_user:) | |||||
| TagVersioning.record!(target_tag, event_type: :update, created_by_user:) | TagVersioning.record!(target_tag, event_type: :update, created_by_user:) | ||||
| end | end | ||||
| @@ -205,9 +205,9 @@ class Tag < ApplicationRecord | |||||
| def snapshot_aliases = tag_name.aliases.kept.order(:name).pluck(:name) | def snapshot_aliases = tag_name.aliases.kept.order(:name).pluck(:name) | ||||
| def snapshot_parent_tag_ids = parents.order('id').pluck('id') | |||||
| def snapshot_parent_tag_ids = parents.order(:id).pluck(:id) | |||||
| def snapshot_linked_tags | |||||
| def snapshot_linked_tag_names | |||||
| linked_tags.joins(:tag_name).order('tag_names.name').pluck('tag_names.name') | linked_tags.joins(:tag_name).order('tag_names.name').pluck('tag_names.name') | ||||
| end | end | ||||
| @@ -4,8 +4,6 @@ require 'set' | |||||
| class WikiPage < ApplicationRecord | class WikiPage < ApplicationRecord | ||||
| include MyDiscard | include MyDiscard | ||||
| default_scope -> { kept } | |||||
| has_many :wiki_revisions, dependent: :destroy | has_many :wiki_revisions, dependent: :destroy | ||||
| belongs_to :created_user, class_name: 'User' | belongs_to :created_user, class_name: 'User' | ||||
| belongs_to :updated_user, class_name: 'User' | belongs_to :updated_user, class_name: 'User' | ||||
| @@ -14,6 +14,6 @@ class NicoTagVersionRecorder < VersionRecorder | |||||
| def record_key = :tag | def record_key = :tag | ||||
| def snapshot_attributes | def snapshot_attributes | ||||
| { name: @record.name, linked_tags: @record.snapshot_linked_tags.join(' ') } | |||||
| { name: @record.name, linked_tags: @record.snapshot_linked_tag_names.join(' ') } | |||||
| end | end | ||||
| end | end | ||||
| @@ -18,7 +18,7 @@ class PostVersionRecorder < VersionRecorder | |||||
| url: @record.url, | url: @record.url, | ||||
| thumbnail_base: @record.thumbnail_base, | thumbnail_base: @record.thumbnail_base, | ||||
| tags: @record.snapshot_tag_names.join(' '), | tags: @record.snapshot_tag_names.join(' '), | ||||
| parent: @record.parent, | |||||
| parent_id: @record.parent_id, | |||||
| original_created_from: @record.original_created_from, | original_created_from: @record.original_created_from, | ||||
| original_created_before: @record.original_created_before } | original_created_before: @record.original_created_before } | ||||
| end | end | ||||