v0.1 Add softdeldeletedposts.rb

This commit is contained in:
David Sainty 2024-09-11 14:34:41 +10:00
parent 5750dfded5
commit a85d33d1e3

View File

@ -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