このコミットが含まれているのは:
@@ -689,6 +689,7 @@ class PostsController < ApplicationController
|
|||||||
version.tags_json
|
version.tags_json
|
||||||
.select { _1.key?('tag_id') }
|
.select { _1.key?('tag_id') }
|
||||||
.map { Post.tag_snapshot_literal(_1) }
|
.map { Post.tag_snapshot_literal(_1) }
|
||||||
|
.compact
|
||||||
.sort
|
.sort
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -716,7 +717,7 @@ class PostsController < ApplicationController
|
|||||||
next name if sections.empty?
|
next name if sections.empty?
|
||||||
|
|
||||||
"#{ name }#{ sections.map { Post.section_literal(_1) }.join }"
|
"#{ name }#{ sections.map { Post.section_literal(_1) }.join }"
|
||||||
end
|
end.compact.sort
|
||||||
end
|
end
|
||||||
|
|
||||||
def post_incoming_snapshot locale:, title:, original_created_from:, original_created_before:,
|
def post_incoming_snapshot locale:, title:, original_created_from:, original_created_before:,
|
||||||
@@ -725,6 +726,7 @@ class PostsController < ApplicationController
|
|||||||
|
|
||||||
Tag.normalise_tags!(locale, tag_names,
|
Tag.normalise_tags!(locale, tag_names,
|
||||||
with_tagme: false,
|
with_tagme: false,
|
||||||
|
with_no_deerjikist: false,
|
||||||
deny_deprecated: true,
|
deny_deprecated: true,
|
||||||
with_sections: true) => { tags:, sections: }
|
with_sections: true) => { tags:, sections: }
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ class TagVersionsController < ApplicationController
|
|||||||
SQL
|
SQL
|
||||||
.select('tag_versions.*', 'prev.name AS prev_name', 'prev.category AS prev_category',
|
.select('tag_versions.*', 'prev.name AS prev_name', 'prev.category AS prev_category',
|
||||||
'prev.deprecated_at AS prev_deprecated_at',
|
'prev.deprecated_at AS prev_deprecated_at',
|
||||||
'prev.aliases AS prev_aliases', 'prev.parent_tag_ids AS prev_parent_tag_ids')
|
'prev.aliases AS prev_aliases', 'prev.names AS prev_names',
|
||||||
|
'prev.parent_tag_ids AS prev_parent_tag_ids')
|
||||||
q = q.where('tag_versions.tag_id = ?', tag_id) if tag_id
|
q = q.where('tag_versions.tag_id = ?', tag_id) if tag_id
|
||||||
|
|
||||||
count = q.except(:select, :order, :limit, :offset).count
|
count = q.except(:select, :order, :limit, :offset).count
|
||||||
@@ -38,8 +39,10 @@ class TagVersionsController < ApplicationController
|
|||||||
users_by_id = User.where(id: user_ids).pluck(:id, :name).to_h
|
users_by_id = User.where(id: user_ids).pluck(:id, :name).to_h
|
||||||
|
|
||||||
rows.map do |row|
|
rows.map do |row|
|
||||||
cur_aliases = split_values(row.aliases)
|
current_names = names_for_locale(row.names, language_code)
|
||||||
prev_aliases = split_values(row.attributes['prev_aliases'])
|
previous_names = names_for_locale(row.attributes['prev_names'], language_code)
|
||||||
|
cur_aliases = current_names.reject { _1['primary_flg'] }.map { _1['name'] }
|
||||||
|
prev_aliases = previous_names.reject { _1['primary_flg'] }.map { _1['name'] }
|
||||||
|
|
||||||
cur_parent_tag_ids = split_parent_tag_ids(row.parent_tag_ids)
|
cur_parent_tag_ids = split_parent_tag_ids(row.parent_tag_ids)
|
||||||
prev_parent_tag_ids = split_parent_tag_ids(row.attributes['prev_parent_tag_ids'])
|
prev_parent_tag_ids = split_parent_tag_ids(row.attributes['prev_parent_tag_ids'])
|
||||||
@@ -63,7 +66,8 @@ class TagVersionsController < ApplicationController
|
|||||||
version_no: row.version_no,
|
version_no: row.version_no,
|
||||||
event_type: row.event_type,
|
event_type: row.event_type,
|
||||||
names: row.names,
|
names: row.names,
|
||||||
name: { current: row.name, prev: row.attributes['prev_name'] },
|
name: { current: current_names.find { _1['primary_flg'] }&.fetch('name'),
|
||||||
|
prev: previous_names.find { _1['primary_flg'] }&.fetch('name') },
|
||||||
category: { current: row.category, prev: row.attributes['prev_category'] },
|
category: { current: row.category, prev: row.attributes['prev_category'] },
|
||||||
deprecated_at: { current: row.deprecated_at&.iso8601,
|
deprecated_at: { current: row.deprecated_at&.iso8601,
|
||||||
prev: row.attributes['prev_deprecated_at']&.iso8601 },
|
prev: row.attributes['prev_deprecated_at']&.iso8601 },
|
||||||
@@ -93,5 +97,12 @@ class TagVersionsController < ApplicationController
|
|||||||
|
|
||||||
def split_values(values) = values.to_s.split(/\s+/).reject(&:blank?)
|
def split_values(values) = values.to_s.split(/\s+/).reject(&:blank?)
|
||||||
|
|
||||||
|
def names_for_locale names, language_code
|
||||||
|
values = names.is_a?(String) ? JSON.parse(names) : Array(names)
|
||||||
|
values.select { _1['language_code'] == language_code }
|
||||||
|
rescue JSON::ParserError
|
||||||
|
[]
|
||||||
|
end
|
||||||
|
|
||||||
def split_parent_tag_ids(values) = split_values(values).map(&:to_i)
|
def split_parent_tag_ids(values) = split_values(values).map(&:to_i)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -473,7 +473,7 @@ class TagsController < ApplicationController
|
|||||||
end
|
end
|
||||||
rename_tag_name!(locale, tag, name) if name_changed
|
rename_tag_name!(locale, tag, name) if name_changed
|
||||||
|
|
||||||
alias_names << old_name if name_changed
|
alias_names << old_name if name_changed && old_name.present?
|
||||||
alias_names.delete(name)
|
alias_names.delete(name)
|
||||||
|
|
||||||
update_aliases!(locale, tag, alias_names)
|
update_aliases!(locale, tag, alias_names)
|
||||||
@@ -772,6 +772,7 @@ class TagsController < ApplicationController
|
|||||||
script_code: locale.script_code,
|
script_code: locale.script_code,
|
||||||
name:,
|
name:,
|
||||||
primary_flg: true)
|
primary_flg: true)
|
||||||
|
tag.association(:tag_names).reset
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -786,6 +787,9 @@ class TagsController < ApplicationController
|
|||||||
TagVersioning.ensure_snapshot!(old_owner_tag, created_by_user: current_user)
|
TagVersioning.ensure_snapshot!(old_owner_tag, created_by_user: current_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
current_tag_name.wiki_page&.update!(tag_name_id: promoted_tag_name.id)
|
||||||
|
current_tag_name.association(:wiki_page).reset
|
||||||
|
|
||||||
current_tag_name.update!(canonical_id: promoted_tag_name.id, primary_flg: false)
|
current_tag_name.update!(canonical_id: promoted_tag_name.id, primary_flg: false)
|
||||||
promoted_tag_name.update!(tag:, canonical_id: nil, primary_flg: true)
|
promoted_tag_name.update!(tag:, canonical_id: nil, primary_flg: true)
|
||||||
|
|
||||||
@@ -797,7 +801,6 @@ class TagsController < ApplicationController
|
|||||||
alias_tag_name.update!(canonical_id: promoted_tag_name.id, primary_flg: false)
|
alias_tag_name.update!(canonical_id: promoted_tag_name.id, primary_flg: false)
|
||||||
end
|
end
|
||||||
|
|
||||||
current_tag_name.wiki_page&.update!(tag_name_id: promoted_tag_name.id)
|
|
||||||
tag.update!(tag_name_id: promoted_tag_name.id)
|
tag.update!(tag_name_id: promoted_tag_name.id)
|
||||||
current_tag_name.association(:wiki_page).reset
|
current_tag_name.association(:wiki_page).reset
|
||||||
current_tag_name.association(:tag).reset
|
current_tag_name.association(:tag).reset
|
||||||
@@ -815,7 +818,9 @@ class TagsController < ApplicationController
|
|||||||
|
|
||||||
affected_tags = [tag]
|
affected_tags = [tag]
|
||||||
|
|
||||||
primary_tag_name = tag.tag_name(locale.language_code)
|
primary_tag_name = TagName.find_by!(tag:,
|
||||||
|
language_code: locale.language_code,
|
||||||
|
primary_flg: true)
|
||||||
current_aliases = tag.tag_names.where(language_code: locale.language_code,
|
current_aliases = tag.tag_names.where(language_code: locale.language_code,
|
||||||
primary_flg: false).to_a
|
primary_flg: false).to_a
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,11 @@ class WikiPagesController < ApplicationController
|
|||||||
return render_unprocessable_entity('タイトルは必須です.', field: :title) if title.blank?
|
return render_unprocessable_entity('タイトルは必須です.', field: :title) if title.blank?
|
||||||
return render_unprocessable_entity('本文は必須です.', field: :body) if body.blank?
|
return render_unprocessable_entity('本文は必須です.', field: :body) if body.blank?
|
||||||
|
|
||||||
tag_name = TagName.find_or_create_by!(name: title)
|
tag_name = TagName.find_or_create_by!(language_code: 'ja', name: title) do |name|
|
||||||
|
name.script_code = 'Jpan'
|
||||||
|
name.primary_flg = true
|
||||||
|
name.auto_generated = false
|
||||||
|
end
|
||||||
|
|
||||||
page =
|
page =
|
||||||
Wiki::Commit.create_content!(
|
Wiki::Commit.create_content!(
|
||||||
|
|||||||
+23
-1
@@ -64,6 +64,7 @@ class Tag < ApplicationRecord
|
|||||||
validates :category, presence: true, inclusion: { in: Tag.categories.keys }
|
validates :category, presence: true, inclusion: { in: Tag.categories.keys }
|
||||||
|
|
||||||
validate :category_must_be_deerjikist_with_deerjikists
|
validate :category_must_be_deerjikist_with_deerjikists
|
||||||
|
validate :tag_names_must_be_valid
|
||||||
|
|
||||||
CATEGORY_PREFIXES = {
|
CATEGORY_PREFIXES = {
|
||||||
'general:' => :general,
|
'general:' => :general,
|
||||||
@@ -77,10 +78,22 @@ class Tag < ApplicationRecord
|
|||||||
'mtr:' => :material,
|
'mtr:' => :material,
|
||||||
'meta:' => :meta }.freeze
|
'meta:' => :meta }.freeze
|
||||||
|
|
||||||
def tag_name(language_code) = tag_names.find_by(language_code:, primary_flg: true)
|
SYSTEM_TAG_NAMES = ['タグ希望', 'bot操作', 'ニジラー情報不詳', '動画', 'ニコニコ', 'YouTube'].freeze
|
||||||
|
|
||||||
|
def tag_name language_code
|
||||||
|
if tag_names.loaded?
|
||||||
|
tag_names.find { _1.language_code == language_code && _1.primary_flg }
|
||||||
|
else
|
||||||
|
tag_names.find_by(language_code:, primary_flg: true)
|
||||||
|
end
|
||||||
|
end
|
||||||
def name(language_code) = tag_name(language_code)&.name
|
def name(language_code) = tag_name(language_code)&.name
|
||||||
def wiki_page = tag_name('ja')&.wiki_page
|
def wiki_page = tag_name('ja')&.wiki_page
|
||||||
|
|
||||||
|
def system?
|
||||||
|
tag_name('ja')&.name.in?(SYSTEM_TAG_NAMES)
|
||||||
|
end
|
||||||
|
|
||||||
def deprecated? = deprecated_at?
|
def deprecated? = deprecated_at?
|
||||||
|
|
||||||
def has_wiki = wiki_page.present?
|
def has_wiki = wiki_page.present?
|
||||||
@@ -232,6 +245,7 @@ class Tag < ApplicationRecord
|
|||||||
|
|
||||||
tag = Tag.create!(tag_name_id: tn.id, category:)
|
tag = Tag.create!(tag_name_id: tn.id, category:)
|
||||||
tn.update!(tag:)
|
tn.update!(tag:)
|
||||||
|
tag.association(:tag_names).reset
|
||||||
|
|
||||||
tag
|
tag
|
||||||
rescue ActiveRecord::RecordNotUnique
|
rescue ActiveRecord::RecordNotUnique
|
||||||
@@ -307,6 +321,14 @@ class Tag < ApplicationRecord
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def tag_names_must_be_valid
|
||||||
|
tag_names.each do |tag_name|
|
||||||
|
next if tag_name.valid?
|
||||||
|
|
||||||
|
tag_name.errors[:name].each { errors.add :name, _1 }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def category_must_be_deerjikist_with_deerjikists
|
def category_must_be_deerjikist_with_deerjikists
|
||||||
if !(deerjikist?) && deerjikists.exists?
|
if !(deerjikist?) && deerjikists.exists?
|
||||||
errors.add :category, 'ニジラーと紐づいてゐるタグはニジラー・カテゴリである必要があります.'
|
errors.add :category, 'ニジラーと紐づいてゐるタグはニジラー・カテゴリである必要があります.'
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ module PostRepr
|
|||||||
post
|
post
|
||||||
.post_tags
|
.post_tags
|
||||||
.reject { _1.tag.deprecated? }
|
.reject { _1.tag.deprecated? }
|
||||||
.sort_by { _1.tag.name(language_code) }
|
.sort_by { TagRepr.name_for(_1.tag, language_code) }
|
||||||
.map { |post_tag|
|
.map { |post_tag|
|
||||||
TagRepr.inline(post_tag.tag, language_code:).merge(
|
TagRepr.inline(post_tag.tag, language_code:).merge(
|
||||||
'children' => [],
|
'children' => [],
|
||||||
|
|||||||
@@ -8,14 +8,18 @@ module TagRepr
|
|||||||
module_function
|
module_function
|
||||||
|
|
||||||
def base tag, language_code: 'ja'
|
def base tag, language_code: 'ja'
|
||||||
tag.as_json(BASE).merge(name: tag.name(language_code),
|
tag.as_json(BASE).merge(name: name_for(tag, language_code),
|
||||||
aliases: tag.snapshot_aliases(language_code),
|
aliases: tag.snapshot_aliases(language_code),
|
||||||
parents: tag.parents.map { inline(_1, language_code:) })
|
parents: tag.parents.map { inline(_1, language_code:) })
|
||||||
end
|
end
|
||||||
|
|
||||||
def inline tag, language_code: 'ja'
|
def inline tag, language_code: 'ja'
|
||||||
tag.as_json(BASE).merge(name: tag.name(language_code), aliases: [], parents: [])
|
tag.as_json(BASE).merge(name: name_for(tag, language_code), aliases: [], parents: [])
|
||||||
end
|
end
|
||||||
|
|
||||||
def many(tags, language_code: 'ja') = tags.map { |tag| base(tag, language_code:) }
|
def many(tags, language_code: 'ja') = tags.map { |tag| base(tag, language_code:) }
|
||||||
|
|
||||||
|
def name_for tag, language_code
|
||||||
|
tag.name(language_code) || (tag.system? ? tag.name('ja') : nil)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -463,7 +463,7 @@ class PostImportPreviewer
|
|||||||
TagName.canonicalise(locale, name.sub(/\[.*\]\z/, '')).first
|
TagName.canonicalise(locale, name.sub(/\[.*\]\z/, '')).first
|
||||||
}
|
}
|
||||||
existing = parsed.filter_map { known_tags[_1] }
|
existing = parsed.filter_map { known_tags[_1] }
|
||||||
deprecated = existing.select(&:deprecated?).map(&:name)
|
deprecated = existing.select(&:deprecated?).map { _1.name(locale.language_code) }
|
||||||
errors[:tags] = ["廃止済みタグがあります: #{ deprecated.join(' ') }"] if deprecated.present?
|
errors[:tags] = ["廃止済みタグがあります: #{ deprecated.join(' ') }"] if deprecated.present?
|
||||||
rescue Tag::SectionLiteralParseError
|
rescue Tag::SectionLiteralParseError
|
||||||
errors[:tags] = ['タグ区間の記法が不正です.']
|
errors[:tags] = ['タグ区間の記法が不正です.']
|
||||||
|
|||||||
@@ -15,23 +15,24 @@ class TagVersionRecorder < VersionRecorder
|
|||||||
|
|
||||||
def snapshot_attributes
|
def snapshot_attributes
|
||||||
names = snapshot_names
|
names = snapshot_names
|
||||||
japanese_names = names.select { _1[:language_code] == 'ja' }
|
japanese_names = names.select { _1['language_code'] == 'ja' }
|
||||||
compatibility_names = japanese_names.presence || names
|
compatibility_names = japanese_names.presence || names
|
||||||
|
|
||||||
{ name: compatibility_names.find { _1[:primary_flg] }[:name],
|
{ name: compatibility_names.find { _1['primary_flg'] }['name'],
|
||||||
category: @record.category,
|
category: @record.category,
|
||||||
deprecated_at: @record.deprecated_at,
|
deprecated_at: @record.deprecated_at,
|
||||||
aliases: compatibility_names.reject { _1[:primary_flg] }.map { _1[:name] }.join(' '),
|
aliases: compatibility_names.reject { _1['primary_flg'] }.map { _1['name'] }.join(' '),
|
||||||
names:,
|
names:,
|
||||||
parent_tag_ids: @record.snapshot_parent_tag_ids.join(' ') }
|
parent_tag_ids: @record.snapshot_parent_tag_ids.join(' ') }
|
||||||
end
|
end
|
||||||
|
|
||||||
def snapshot_names
|
def snapshot_names
|
||||||
@record.tag_names.order(:language_code, primary_flg: :desc).order(:name).map { |tag_name|
|
@record.tag_names.order(:language_code, primary_flg: :desc).order(:name).map { |tag_name|
|
||||||
{ language_code: tag_name.language_code,
|
{ 'language_code' => tag_name.language_code,
|
||||||
name: tag_name.name,
|
'name' => tag_name.name,
|
||||||
script_code: tag_name.script_code,
|
'script_code' => tag_name.script_code,
|
||||||
primary_flg: tag_name.primary_flg }
|
'primary_flg' => tag_name.primary_flg,
|
||||||
|
'auto_generated' => tag_name.auto_generated }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ class AddNamesToTagVersions < ActiveRecord::Migration[8.0]
|
|||||||
language_code: 'ja',
|
language_code: 'ja',
|
||||||
name: version.name,
|
name: version.name,
|
||||||
script_code: 'Jpan',
|
script_code: 'Jpan',
|
||||||
primary_flg: true }]
|
primary_flg: true,
|
||||||
|
auto_generated: false }]
|
||||||
names.concat(version.aliases.to_s.split.filter_map { |name|
|
names.concat(version.aliases.to_s.split.filter_map { |name|
|
||||||
next if name.blank?
|
next if name.blank?
|
||||||
|
|
||||||
@@ -21,7 +22,8 @@ class AddNamesToTagVersions < ActiveRecord::Migration[8.0]
|
|||||||
language_code: 'ja',
|
language_code: 'ja',
|
||||||
name:,
|
name:,
|
||||||
script_code: 'Jpan',
|
script_code: 'Jpan',
|
||||||
primary_flg: false }
|
primary_flg: false,
|
||||||
|
auto_generated: false }
|
||||||
})
|
})
|
||||||
version.update_columns(names: names)
|
version.update_columns(names: names)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
class AddAutoGeneratedToTagNames < ActiveRecord::Migration[8.0]
|
||||||
|
class TagVersion < ActiveRecord::Base
|
||||||
|
self.table_name = 'tag_versions'
|
||||||
|
end
|
||||||
|
|
||||||
|
def up
|
||||||
|
add_column :tag_names, :auto_generated, :boolean, null: false, default: false
|
||||||
|
TagVersion.reset_column_information
|
||||||
|
|
||||||
|
TagVersion.find_each do |version|
|
||||||
|
names = Array(version.names).map { |name| name.merge('auto_generated' => false) }
|
||||||
|
version.update_columns(names: names)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
remove_column :tag_names, :auto_generated
|
||||||
|
end
|
||||||
|
end
|
||||||
生成ファイル
+2
-1
@@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[8.0].define(version: 2026_09_22_040000) do
|
ActiveRecord::Schema[8.0].define(version: 2026_09_22_050000) do
|
||||||
create_table "active_storage_attachments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
create_table "active_storage_attachments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||||
t.string "name", null: false
|
t.string "name", null: false
|
||||||
t.string "record_type", null: false
|
t.string "record_type", null: false
|
||||||
@@ -454,6 +454,7 @@ ActiveRecord::Schema[8.0].define(version: 2026_09_22_040000) do
|
|||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.virtual "primary_tag_id", type: :bigint, as: "(case when `primary_flg` then `tag_id` else NULL end)"
|
t.virtual "primary_tag_id", type: :bigint, as: "(case when `primary_flg` then `tag_id` else NULL end)"
|
||||||
|
t.boolean "auto_generated", default: false, null: false
|
||||||
t.index ["canonical_id"], name: "index_tag_names_on_canonical_id"
|
t.index ["canonical_id"], name: "index_tag_names_on_canonical_id"
|
||||||
t.index ["language_code", "name"], name: "index_tag_names_on_language_code_and_name", unique: true
|
t.index ["language_code", "name"], name: "index_tag_names_on_language_code_and_name", unique: true
|
||||||
t.index ["primary_tag_id", "language_code"], name: "index_tag_names_on_primary_tag_id_and_language_code", unique: true
|
t.index ["primary_tag_id", "language_code"], name: "index_tag_names_on_primary_tag_id_and_language_code", unique: true
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ FactoryBot.define do
|
|||||||
language_code { 'ja' }
|
language_code { 'ja' }
|
||||||
script_code { 'Jpan' }
|
script_code { 'Jpan' }
|
||||||
primary_flg { true }
|
primary_flg { true }
|
||||||
|
auto_generated { false }
|
||||||
sequence(:name) { |number| "tag-#{ SecureRandom.hex(4) }-#{ number }" }
|
sequence(:name) { |number| "tag-#{ SecureRandom.hex(4) }-#{ number }" }
|
||||||
|
|
||||||
trait :alias do
|
trait :alias do
|
||||||
|
|||||||
@@ -23,13 +23,13 @@ RSpec.describe TagVersionRecorder do
|
|||||||
|
|
||||||
expect(version.names).to eq([
|
expect(version.names).to eq([
|
||||||
{ 'language_code' => 'en', 'name' => 'English name', 'script_code' => 'Latn',
|
{ 'language_code' => 'en', 'name' => 'English name', 'script_code' => 'Latn',
|
||||||
'primary_flg' => true },
|
'primary_flg' => true, 'auto_generated' => false },
|
||||||
{ 'language_code' => 'en', 'name' => 'English alias', 'script_code' => 'Latn',
|
{ 'language_code' => 'en', 'name' => 'English alias', 'script_code' => 'Latn',
|
||||||
'primary_flg' => false },
|
'primary_flg' => false, 'auto_generated' => false },
|
||||||
{ 'language_code' => 'ja', 'name' => '日本語名', 'script_code' => 'Jpan',
|
{ 'language_code' => 'ja', 'name' => '日本語名', 'script_code' => 'Jpan',
|
||||||
'primary_flg' => true },
|
'primary_flg' => true, 'auto_generated' => false },
|
||||||
{ 'language_code' => 'ja', 'name' => '別名', 'script_code' => 'Jpan',
|
{ 'language_code' => 'ja', 'name' => '別名', 'script_code' => 'Jpan',
|
||||||
'primary_flg' => false }
|
'primary_flg' => false, 'auto_generated' => false }
|
||||||
])
|
])
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -44,4 +44,13 @@ RSpec.describe TagVersionRecorder do
|
|||||||
hash_including('language_code' => 'en', 'name' => 'English name'))
|
hash_including('language_code' => 'en', 'name' => 'English name'))
|
||||||
expect(updated.names).to include(hash_including('language_code' => 'en', 'name' => 'Renamed'))
|
expect(updated.names).to include(hash_including('language_code' => 'en', 'name' => 'Renamed'))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'does not create a version for an unchanged multilingual snapshot' do
|
||||||
|
described_class.record!(tag:, event_type: :create, created_by_user: user)
|
||||||
|
|
||||||
|
unchanged = described_class.record!(tag:, event_type: :update, created_by_user: user)
|
||||||
|
|
||||||
|
expect(unchanged.version_no).to eq(1)
|
||||||
|
expect(tag.reload.tag_versions.count).to eq(1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
新しいイシューから参照
ユーザーをブロックする