Browse Source

#309

feature/309
みてるぞ 2 weeks ago
parent
commit
58429c5e8b
4 changed files with 5 additions and 7 deletions
  1. +3
    -3
      backend/app/models/tag.rb
  2. +0
    -2
      backend/app/models/wiki_page.rb
  3. +1
    -1
      backend/app/services/nico_tag_version_recorder.rb
  4. +1
    -1
      backend/app/services/post_version_recorder.rb

+ 3
- 3
backend/app/models/tag.rb View File

@@ -180,7 +180,6 @@ class Tag < ApplicationRecord
end

source_tag.discard!
TagVersioning.record!(source_tag, event_type: :discard, created_by_user:)

if source_tag.nico?
source_tag_name.discard!
@@ -189,6 +188,7 @@ class Tag < ApplicationRecord
updated_at: Time.current)
end

TagVersioning.record!(source_tag, event_type: :discard, created_by_user:)
TagVersioning.record!(target_tag, event_type: :update, created_by_user:)
end

@@ -205,9 +205,9 @@ class Tag < ApplicationRecord

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')
end



+ 0
- 2
backend/app/models/wiki_page.rb View File

@@ -4,8 +4,6 @@ require 'set'
class WikiPage < ApplicationRecord
include MyDiscard

default_scope -> { kept }

has_many :wiki_revisions, dependent: :destroy
belongs_to :created_user, class_name: 'User'
belongs_to :updated_user, class_name: 'User'


+ 1
- 1
backend/app/services/nico_tag_version_recorder.rb View File

@@ -14,6 +14,6 @@ class NicoTagVersionRecorder < VersionRecorder
def record_key = :tag

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

+ 1
- 1
backend/app/services/post_version_recorder.rb View File

@@ -18,7 +18,7 @@ class PostVersionRecorder < VersionRecorder
url: @record.url,
thumbnail_base: @record.thumbnail_base,
tags: @record.snapshot_tag_names.join(' '),
parent: @record.parent,
parent_id: @record.parent_id,
original_created_from: @record.original_created_from,
original_created_before: @record.original_created_before }
end


Loading…
Cancel
Save