v0.1 Add softdeldeletedposts.rb
This commit is contained in:
parent
5750dfded5
commit
a85d33d1e3
@ -56,7 +56,10 @@ class GossamerForumsSoftDelDeletedPosts < ImportScripts::Base
|
|||||||
puts " - Topic title: '#{topic.title}' (Topic ID: #{topic.id})"
|
puts " - Topic title: '#{topic.title}' (Topic ID: #{topic.id})"
|
||||||
|
|
||||||
# Perform the soft delete by updating the fields
|
# 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
|
else
|
||||||
puts "SoftDelDeletedPosts: Post with id: #{post.id} is already soft deleted."
|
puts "SoftDelDeletedPosts: Post with id: #{post.id} is already soft deleted."
|
||||||
end
|
end
|
||||||
@ -106,7 +109,7 @@ def soft_undelete_post(post)
|
|||||||
puts " - Topic title: '#{topic.title}' (Topic ID: #{topic.id})"
|
puts " - Topic title: '#{topic.title}' (Topic ID: #{topic.id})"
|
||||||
|
|
||||||
# Reverse the soft delete by setting deleted_at and deleted_by_id to nil
|
# 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
|
else
|
||||||
puts "SoftDelDeletedPosts: Post with id: #{post.id} is not soft deleted."
|
puts "SoftDelDeletedPosts: Post with id: #{post.id} is not soft deleted."
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user