このコミットが含まれているのは:
@@ -213,6 +213,8 @@ class PostsController < ApplicationController
|
||||
return head :unauthorized unless current_user
|
||||
return head :forbidden unless current_user.gte_member?
|
||||
|
||||
locale = resolve_locale!
|
||||
|
||||
preflight = PostCreatePreflight.new(
|
||||
attributes: post_create_attributes,
|
||||
thumbnail: params[:thumbnail],
|
||||
@@ -242,7 +244,7 @@ class PostsController < ApplicationController
|
||||
:post_tag_specs,
|
||||
:tag_sections,
|
||||
:normalised_parent_post_ids).symbolize_keys).merge(
|
||||
thumbnail: params[:thumbnail])).create!
|
||||
thumbnail: params[:thumbnail])).create!(locale)
|
||||
|
||||
post.reload
|
||||
render json: PostRepr.base(post), status: :created
|
||||
|
||||
@@ -6,7 +6,7 @@ class PostBulkCreator
|
||||
@host = host
|
||||
end
|
||||
|
||||
def run
|
||||
def run locale
|
||||
results = Array.new(@posts.length)
|
||||
mutex = Mutex.new
|
||||
next_index = 0
|
||||
@@ -27,7 +27,7 @@ class PostBulkCreator
|
||||
break if index >= @posts.length
|
||||
|
||||
attributes = @posts[index]
|
||||
results[index] = create_row(actor, attributes, index)
|
||||
results[index] = create_row(locale, actor, attributes, index)
|
||||
rescue StandardError => e
|
||||
Rails.logger.error(
|
||||
"post_bulk_creator_worker_failure #{ { error: e.class.name,
|
||||
@@ -61,7 +61,7 @@ class PostBulkCreator
|
||||
|
||||
private
|
||||
|
||||
def create_row actor, attributes, index
|
||||
def create_row locale, actor, attributes, index
|
||||
preflight =
|
||||
PostCreatePreflight.new(
|
||||
attributes: attributes,
|
||||
@@ -76,7 +76,7 @@ class PostBulkCreator
|
||||
|
||||
post = PostCreator.new(
|
||||
actor: actor,
|
||||
attributes: normalised_attributes(attributes, preflight, index)).create!
|
||||
attributes: normalised_attributes(attributes, preflight, index)).create!(locale)
|
||||
result = {
|
||||
status: 'created',
|
||||
post: { id: post.id } }
|
||||
|
||||
@@ -9,7 +9,7 @@ class PostCreator
|
||||
@field_warnings = { }
|
||||
end
|
||||
|
||||
def create!(locale)
|
||||
def create! locale
|
||||
thumbnail_attachment = prepare_thumbnail_attachment
|
||||
post = Post.new(title: @attributes[:title].presence,
|
||||
url: @attributes[:url],
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする