このコミットが含まれているのは:
@@ -27,6 +27,7 @@ class PostCreatePlan
|
||||
original_created_from: @attributes[:original_created_from].presence,
|
||||
original_created_before: @attributes[:original_created_before].presence,
|
||||
tags: serialised_tags(direct_tag_specs, tag_sections),
|
||||
display_tags: display_tags(direct_tag_specs, tag_sections),
|
||||
duration: @attributes[:duration].to_s,
|
||||
video_ms: video_ms,
|
||||
parent_post_ids: parent_post_ids.join(' '),
|
||||
@@ -204,6 +205,15 @@ class PostCreatePlan
|
||||
}.sort.join(' ')
|
||||
end
|
||||
|
||||
def display_tags direct_tag_specs, tag_sections
|
||||
direct_tag_specs.map { |spec|
|
||||
{
|
||||
name: spec[:name],
|
||||
category: spec[:category].to_s,
|
||||
section_literals: tag_sections[spec[:name]].to_a.map { Post.section_literal(_1) } }
|
||||
}.sort_by { _1[:name] }
|
||||
end
|
||||
|
||||
def normalise_video_ms snapshot_tag_specs
|
||||
return nil unless snapshot_tag_specs.any? { _1[:name] == VIDEO_TAG_NAME }
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ class PostCreatePreflight
|
||||
original_created_before: preview[:attributes]['original_created_before'],
|
||||
duration: preview[:attributes]['duration'],
|
||||
video_ms: preview[:attributes]['video_ms'],
|
||||
display_tags: preview[:display_tags] || [],
|
||||
field_warnings: final_field_warnings(preview[:field_warnings] || { }),
|
||||
base_warnings: preview[:base_warnings],
|
||||
existing_post_id: preview[:existing_post_id],
|
||||
@@ -63,6 +64,7 @@ class PostCreatePreflight
|
||||
original_created_before: plan[:original_created_before],
|
||||
duration: plan[:duration],
|
||||
video_ms: plan[:video_ms],
|
||||
display_tags: plan[:display_tags],
|
||||
direct_tag_specs: plan[:direct_tag_specs],
|
||||
default_tag_specs: plan[:default_tag_specs],
|
||||
snapshot_tag_specs: plan[:snapshot_tag_specs],
|
||||
|
||||
@@ -32,6 +32,7 @@ class PostMetadataFetcher
|
||||
original_created_from: serialise_time(created_range&.first),
|
||||
original_created_before: serialise_time(created_range&.last),
|
||||
duration: serialise_duration(duration),
|
||||
display_tags: display_tags(platform_tags),
|
||||
tags: platform_tags.join(' ') }
|
||||
end
|
||||
|
||||
@@ -42,6 +43,24 @@ class PostMetadataFetcher
|
||||
[]
|
||||
end
|
||||
|
||||
def self.display_tags names
|
||||
return [] if names.blank?
|
||||
|
||||
existing_tags =
|
||||
Tag
|
||||
.joins(:tag_name)
|
||||
.where(tag_names: { name: names })
|
||||
.index_by(&:name)
|
||||
|
||||
names.map { |name|
|
||||
tag = existing_tags[name]
|
||||
{
|
||||
name: name,
|
||||
category: (tag&.category || 'meta'),
|
||||
section_literals: [] }
|
||||
}
|
||||
end
|
||||
|
||||
def self.original_created_range value
|
||||
return nil if value.blank?
|
||||
|
||||
@@ -168,6 +187,7 @@ class PostMetadataFetcher
|
||||
end
|
||||
|
||||
private_class_method :platform_tags,
|
||||
:display_tags,
|
||||
:original_created_range,
|
||||
:parse_timestamp_range,
|
||||
:parse_nanoseconds,
|
||||
|
||||
新しい課題から参照
ユーザをブロックする