From 583ce22a7e8eea73d2c7a8f07bb1dea0850647af Mon Sep 17 00:00:00 2001 From: miteruzo Date: Sat, 18 Jul 2026 17:07:56 +0900 Subject: [PATCH] #399 --- backend/app/representations/post_repr.rb | 7 +++++- backend/config/environments/development.rb | 6 ++++- .../src/pages/posts/PostImportReviewPage.tsx | 25 ++++++++----------- .../src/pages/posts/PostImportSourcePage.tsx | 2 +- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/backend/app/representations/post_repr.rb b/backend/app/representations/post_repr.rb index c878291..d113263 100644 --- a/backend/app/representations/post_repr.rb +++ b/backend/app/representations/post_repr.rb @@ -69,7 +69,12 @@ module PostRepr return nil unless post.thumbnail.attached? Rails.application.routes.url_helpers.rails_blob_url(post.thumbnail, only_path: false) - rescue + rescue ActionController::UrlGenerationError, ArgumentError, URI::InvalidURIError => e + Rails.logger.warn( + "PostRepr.thumbnail_url failed post_id=#{post.id} " \ + "attachment_id=#{post.thumbnail.attachment&.id} " \ + "blob_id=#{post.thumbnail.blob&.id} " \ + "error_class=#{e.class} message=#{e.message}") nil end end diff --git a/backend/config/environments/development.rb b/backend/config/environments/development.rb index e7722fc..365b5c0 100644 --- a/backend/config/environments/development.rb +++ b/backend/config/environments/development.rb @@ -36,7 +36,11 @@ Rails.application.configure do config.action_mailer.perform_caching = false # Set localhost to be used by links generated in mailer templates. - config.action_mailer.default_url_options = { host: "localhost", port: 3000 } + config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } + Rails.application.routes.default_url_options.merge!( + host: 'localhost', + port: 3002, + protocol: 'http') # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log diff --git a/frontend/src/pages/posts/PostImportReviewPage.tsx b/frontend/src/pages/posts/PostImportReviewPage.tsx index 299f64a..41b8eb1 100644 --- a/frontend/src/pages/posts/PostImportReviewPage.tsx +++ b/frontend/src/pages/posts/PostImportReviewPage.tsx @@ -826,9 +826,8 @@ const PostImportReviewPage: FC = ({ user }) => { : rows const existingRows = sortedRows.filter (row => isExistingSkipRow (row)) const reviewRows = sortedRows.filter (row => !(isExistingSkipRow (row))) - const canSubmit = - rows.every (row => isCompletedReviewRow (row)) - || processableImportRows (rows).length > 0 + const processingRows = processableImportRows (rows) + const canSubmit = processingRows.length > 0 const toggleManualSkip = async (sourceRow: number, checked: boolean) => { const currentSession = sessionRef.current @@ -1089,19 +1088,13 @@ const PostImportReviewPage: FC = ({ user }) => { || submitting || busyRowIds.size > 0) return - if (currentSession.rows.every (row => isCompletedReviewRow (row))) - { - finishImport () - return - } + const processingRows = processableImportRows (currentSession.rows) + if (processingRows.length === 0) + return setSubmitting (true) try { - const processingRows = processableImportRows (currentSession.rows) - if (processingRows.length === 0) - return - const result = await apiPost<{ results: BulkApiRow[] }>( '/posts/bulk', buildBulkFormData (processingRows)) @@ -1216,7 +1209,9 @@ const PostImportReviewPage: FC = ({ user }) => { manualSkippedCount={counts.manualSkipped} existingSkippedCount={counts.existingSkipped} pendingOrErrorCount={counts.pendingOrError} - onBack={() => navigate ('/posts/new')} + onBack={() => navigate (location.state?.from === '/posts/new' + ? '/posts/new' + : (-1))} onSubmit={() => submit ()}/> ) } @@ -1251,7 +1246,7 @@ const PostImportFooter = ( 作成対象 {creatableCount}件 手動スキップ {manualSkippedCount}件 既存投稿による自動スキップ {existingSkippedCount}件 - 登録不可/未処理 {pendingOrErrorCount}件 + 未処理 {pendingOrErrorCount}件