このコミットが含まれているのは:
@@ -175,15 +175,23 @@ class PostsController < ApplicationController
|
||||
return head :unauthorized unless current_user
|
||||
return head :forbidden unless current_user.gte_member?
|
||||
|
||||
if bool?(:dry)
|
||||
preflight = PostCreatePreflight.new(
|
||||
attributes: post_create_attributes,
|
||||
thumbnail: params[:thumbnail]).run
|
||||
return render json: preflight
|
||||
end
|
||||
preflight = PostCreatePreflight.new(
|
||||
attributes: post_create_attributes,
|
||||
thumbnail: params[:thumbnail]).run
|
||||
return render json: preflight if bool?(:dry)
|
||||
|
||||
post = PostCreator.new(actor: current_user,
|
||||
attributes: post_create_attributes.merge(
|
||||
preflight.slice(
|
||||
:url,
|
||||
:title,
|
||||
:thumbnail_base,
|
||||
:tags,
|
||||
:parent_post_ids,
|
||||
:original_created_from,
|
||||
:original_created_before,
|
||||
:duration,
|
||||
:video_ms).symbolize_keys).merge(
|
||||
thumbnail: params[:thumbnail])).create!
|
||||
|
||||
post.reload
|
||||
@@ -532,6 +540,7 @@ class PostsController < ApplicationController
|
||||
def parse_bulk_posts_manifest
|
||||
manifest = params[:posts]
|
||||
raise ArgumentError, 'posts は必須です.' if manifest.blank?
|
||||
raise ArgumentError, 'posts は JSON 文字列で指定してください.' unless manifest.is_a?(String)
|
||||
|
||||
posts = JSON.parse(manifest)
|
||||
raise ArgumentError, 'posts は配列で指定してください.' unless posts.is_a?(Array)
|
||||
@@ -569,15 +578,7 @@ class PostsController < ApplicationController
|
||||
return nil if post_id.blank?
|
||||
|
||||
post = Post.with_attached_thumbnail.find_by(id: post_id)
|
||||
return nil if post.nil?
|
||||
|
||||
{ id: post.id,
|
||||
title: post.title,
|
||||
url: post.url,
|
||||
thumbnail_url:
|
||||
if post.thumbnail.attached?
|
||||
rails_storage_proxy_url(post.thumbnail, only_path: false)
|
||||
end }
|
||||
PostCompactRepr.base(post)
|
||||
end
|
||||
|
||||
def sync_parent_posts! post, parent_post_ids
|
||||
|
||||
新しい課題から参照
ユーザをブロックする