このコミットが含まれているのは:
@@ -1,8 +1,9 @@
|
||||
class PostBulkCreator
|
||||
def initialize actor:, posts:, thumbnails:
|
||||
def initialize actor:, posts:, thumbnails:, host: nil
|
||||
@actor_id = actor.id
|
||||
@posts = posts
|
||||
@thumbnails = thumbnails
|
||||
@host = host
|
||||
end
|
||||
|
||||
def run
|
||||
@@ -64,7 +65,8 @@ class PostBulkCreator
|
||||
preflight =
|
||||
PostCreatePreflight.new(
|
||||
attributes: attributes,
|
||||
thumbnail: thumbnail_for(index, attributes)).run
|
||||
thumbnail: thumbnail_for(index, attributes),
|
||||
host: @host).run
|
||||
if preflight[:existing_post_id].present?
|
||||
return {
|
||||
status: 'skipped',
|
||||
@@ -195,6 +197,6 @@ class PostBulkCreator
|
||||
end
|
||||
|
||||
def compact_existing_post post
|
||||
PostCompactRepr.base(post)
|
||||
PostCompactRepr.base(post, host: @host)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,9 +9,10 @@ class PostCreatePreflight
|
||||
end
|
||||
end
|
||||
|
||||
def initialize attributes:, thumbnail: nil
|
||||
def initialize attributes:, thumbnail: nil, host: nil
|
||||
@attributes = attributes.symbolize_keys
|
||||
@thumbnail = thumbnail
|
||||
@host = host
|
||||
end
|
||||
|
||||
def run
|
||||
@@ -124,7 +125,7 @@ class PostCreatePreflight
|
||||
return nil if post_id.blank?
|
||||
|
||||
post = Post.with_attached_thumbnail.find_by(id: post_id)
|
||||
PostCompactRepr.base(post)
|
||||
PostCompactRepr.base(post, host: @host)
|
||||
end
|
||||
|
||||
def final_field_warnings field_warnings
|
||||
|
||||
新しい課題から参照
ユーザをブロックする