diff --git a/app/models/communication/website/imported/post.rb b/app/models/communication/website/imported/post.rb index a6e23f69b5fe765f7ef061c143baf0a10ad60d40..ab669d4d19ff018161ee1f26358ba323e91cd7d2 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 059f700376a0b0bcdc6c4d52522b6844d1801d27..4ec8f8748672906191b67a6f99e0ce9dd31f6287 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