איך להסיר שם משתמש מתגובות לאחר מחיקת הפוסט?

סיכום מבוסס בינה מלאכותית

The discussion revolves around safely removing usernames from replies after the original post has been deleted. j127 shared an image illustrating the issue and asked if setting reply_to_post_number to nil would be a safe solution. Simon_Manning suggested changing the ownership of the deleted post to system or a designated user as a possible alternative. However, j127 found this method tedious and is seeking a more efficient solution, such as running a script in the Rails console to update multiple posts at once.

When a post that has been replied to gets deleted, the username stays on the replies like this:

image

Does anyone know how to safely remove the usernames from the replies after the original post has been deleted? Users regularly ask for their posts to be deleted, but I haven’t been able to completely scrub their data from the pages.

It it safe to just set reply_to_post_number to nil for that post? Or is there a better way to remove the username?

As an admin, I think also a moderator, you can change the ownership of the deleted post. You could change it to system or to a user you create for the purpose, though this may make it more awkward to see who the deleted post was originally made by.

Thanks, I just tried it and it works, but it’s pretty tedious to undelete each post, change the user, and then delete the new version of the post. I often have to do it many times for each content deletion request. Some of the core members like to delete old posts regularly, so it’s quite a bit of work.

Ideally, I’m looking to be able to do something like this:

# I would write a bookmarklet or browser extension that gets the
# post IDs from the current topic and generates the code to paste
# in the Rails console.
[123, 456, 789, 321, 432, 543].each do |post|
  # Is this next line safe or will it leave things dangling somewhere?
  post.reply_to_post_number = nil
  post.save
end

I’m hoping to find out if it’s safe to do that regularly.