From a85d33d1e393a21607b3b20858260f66a37993f8 Mon Sep 17 00:00:00 2001 From: saint Date: Wed, 11 Sep 2024 14:34:41 +1000 Subject: [PATCH] v0.1 Add softdeldeletedposts.rb --- softdeldeletedposts.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/softdeldeletedposts.rb b/softdeldeletedposts.rb index dd4edb2..e5d6239 100644 --- a/softdeldeletedposts.rb +++ b/softdeldeletedposts.rb @@ -56,7 +56,10 @@ class GossamerForumsSoftDelDeletedPosts < ImportScripts::Base puts " - Topic title: '#{topic.title}' (Topic ID: #{topic.id})" # Perform the soft delete by updating the fields - post.update(deleted_at: Time.now, deleted_by_id: deleted_by_id) + ## post.deleted_at = Time.now + ## post.deleted_by_id = deleted_by_id + ## post.save + ### post.update(deleted_at: Time.now, deleted_by_id: deleted_by_id) else puts "SoftDelDeletedPosts: Post with id: #{post.id} is already soft deleted." end @@ -106,7 +109,7 @@ def soft_undelete_post(post) puts " - Topic title: '#{topic.title}' (Topic ID: #{topic.id})" # Reverse the soft delete by setting deleted_at and deleted_by_id to nil - post.update(deleted_at: nil, deleted_by_id: nil) + ### post.update(deleted_at: nil, deleted_by_id: nil) else puts "SoftDelDeletedPosts: Post with id: #{post.id} is not soft deleted." end