From 72961f840a829c5e8ebb34d864b54a57cc4124a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gaya?= <sebastien.gaya@gmail.com> Date: Fri, 22 Oct 2021 11:09:18 +0200 Subject: [PATCH] fix --- app/models/communication/website/imported/post.rb | 9 +++++---- lib/tasks/app.rake | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/models/communication/website/imported/post.rb b/app/models/communication/website/imported/post.rb index a6e23f69b..ab669d4d1 100644 --- a/app/models/communication/website/imported/post.rb +++ b/app/models/communication/website/imported/post.rb @@ -75,11 +75,12 @@ class Communication::Website::Imported::Post < ApplicationRecord website: website.website # Real website, not imported website self.post.title = "Untitled" # No title yet self.post.save + else + # Don't touch if there are local changes (this would destroy some nice work) + # return if post.updated_at > updated_at + # Don't touch if there are no remote changes (this would do useless server workload) + # return if post.updated_at == updated_at end - # Don't touch if there are local changes (this would destroy some nice work) - # return if post.updated_at > updated_at - # Don't touch if there are no remote changes (this would do useless server workload) - # return if post.updated_at == updated_at title = Wordpress.clean title.to_s puts "Update post #{post.id}" post.title = title unless title.blank? # If there is no title, leave it with "Untitled" diff --git a/lib/tasks/app.rake b/lib/tasks/app.rake index 059f70037..4ec8f8748 100644 --- a/lib/tasks/app.rake +++ b/lib/tasks/app.rake @@ -22,6 +22,9 @@ namespace :app do Communication::Website::Post.find_each { |post| post.update(text: post.old_text) } + Communication::Website::Medium.find_each { |medium| + medium.send(:set_featured_images) + } end namespace :db do -- GitLab