このコミットが含まれているのは:
@@ -12,6 +12,7 @@ class PostCreatePlan
|
|||||||
direct_tag_specs, tag_sections = parse_direct_tag_specs
|
direct_tag_specs, tag_sections = parse_direct_tag_specs
|
||||||
default_tag_specs = build_default_tag_specs(direct_tag_specs)
|
default_tag_specs = build_default_tag_specs(direct_tag_specs)
|
||||||
snapshot_tag_specs = merge_tag_specs(direct_tag_specs + default_tag_specs)
|
snapshot_tag_specs = merge_tag_specs(direct_tag_specs + default_tag_specs)
|
||||||
|
preload_existing_tags_by_name!(snapshot_tag_specs.map { _1[:name] })
|
||||||
validate_new_tag_specs!(snapshot_tag_specs)
|
validate_new_tag_specs!(snapshot_tag_specs)
|
||||||
post_tag_specs = expand_parent_tag_specs(snapshot_tag_specs)
|
post_tag_specs = expand_parent_tag_specs(snapshot_tag_specs)
|
||||||
video_ms = normalise_video_ms(snapshot_tag_specs)
|
video_ms = normalise_video_ms(snapshot_tag_specs)
|
||||||
@@ -161,6 +162,17 @@ class PostCreatePlan
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def preload_existing_tags_by_name! names
|
||||||
|
wanted_names = Array(names).map { _1.to_s }.reject(&:blank?).uniq
|
||||||
|
missing_names = wanted_names - existing_tags_by_name.keys
|
||||||
|
return if missing_names.empty?
|
||||||
|
|
||||||
|
existing_tags_by_name.merge!(
|
||||||
|
Tag.joins(:tag_name)
|
||||||
|
.where(tag_names: { name: missing_names })
|
||||||
|
.index_by(&:name))
|
||||||
|
end
|
||||||
|
|
||||||
def canonical_tag_name_without_sections raw_name
|
def canonical_tag_name_without_sections raw_name
|
||||||
name, = parse_raw_tag_name(raw_name)
|
name, = parse_raw_tag_name(raw_name)
|
||||||
name
|
name
|
||||||
|
|||||||
新しい課題から参照
ユーザをブロックする