From c048b892ce086c0316da75db200f3ebc1a5b05a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gaya?= <sebastien.gaya@gmail.com> Date: Tue, 11 Jan 2022 17:38:13 +0100 Subject: [PATCH] fix when author is missing on import --- app/models/communication/website/imported/post.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/communication/website/imported/post.rb b/app/models/communication/website/imported/post.rb index 3481a3ba8..0a6c10cb8 100644 --- a/app/models/communication/website/imported/post.rb +++ b/app/models/communication/website/imported/post.rb @@ -101,7 +101,7 @@ class Communication::Website::Imported::Post < ApplicationRecord post.published = true imported_author = website.authors.where(identifier: author).first - post.author = imported_author.author if imported_author.author + post.author = imported_author.author if imported_author&.author.present? imported_categories = website.categories.where(identifier: categories) imported_categories.each do |imported_category| post.categories << imported_category.category unless post.categories.pluck(:id).include?(imported_category.category_id) -- GitLab