How to remove username from replies after post is deleted?

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?

1 Like

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.

3 Likes

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.