v0.2 Address where due to import issues there are some stray PostCustomField records for Posts that do not exist.

This commit is contained in:
David Sainty 2024-09-11 15:32:02 +10:00
parent e18a7602a8
commit 0363787283

View File

@ -169,14 +169,14 @@ class GossamerForumsSoftDelDeletedPosts < ImportScripts::Base
post = post_custom_field.post post = post_custom_field.post
if post if post
puts "DELETING POST: SoftDelDeletedPosts: Soft deleting post with id: #{post.id} and user_id: #{post.user_id} and topic_id: #{post.topic_id}"
# Get the post's owner and topic information # Get the post's owner and topic information
user = User.find_by(id: post.user_id) # Fetch user details # user = User.find_by(id: post.user_id) # Fetch user details
topic = Topic.find_by(id: post.topic_id) # Fetch topic details # topic = Topic.find_by(id: post.topic_id) # Fetch topic details
# Display post, user, and topic information # Display post, user, and topic information
puts "DELETING POST: SoftDelDeletedPosts: Soft deleting post with id: #{post.id}" # puts " - Post owner: #{user.username} (ID: #{user.id})"
puts " - Post owner: #{user.username} (ID: #{user.id})" # puts " - Topic title: '#{topic.title}' (Topic ID: #{topic.id})"
puts " - Topic title: '#{topic.title}' (Topic ID: #{topic.id})"
# Soft delete the post if not already deleted # Soft delete the post if not already deleted
soft_delete_post(post, deleted_by_id) soft_delete_post(post, deleted_by_id)