Topic keeps getting deleted

Is it possible that the user in question keeps deleting it? I’ve had users who would rather delete posts than endure the “embarrassment” of correcting themselves.

1 Like

Check your log (admin/logs/staff_action_logs) to see if the user is deleting them. The log will show those posts that were both edited and deleted… and by whomever deleted them. You can click on the information icon for more info as well.

Some users have changed their minds about keeping a post for that and many other reasons. Sometimes it’s just one of those situations where one feels it’s just better to forget what they were going to say. Sometimes you just have to accept their reason, even if one isn’t given. :wink:


Users can’t insta-delete topics or posts, though. All they can do is trigger a 24 hour pending delete, which will be a public intent stated in the topic or post, like so:

(post withdrawn by author, will be deleted in 24 hours unless flagged)

Additionally, you can only do this for topics if they have no replies, and the topic is 1 day old or less.


this happens for us as well when a topic gets deleted by the system, that is 24 hours after a post is deleted by the author, there is no way to bring it back; even if we recover it, it gets deleted automatically again after 30 min.


I’ve talked with the user and, as far as I can understand, they’re not constantly deleting it. They were actually surprised about it, as they alerted me to the issue in the first place.

Here’s what my logs look like:

(Thanks @JimPas for the suggestion!)

Any ideas? Any more data I can provide to help troubleshoot the issue? It seems that @Pad_Pors may have encountered something similar.


Did anyone find a solution to this after? We are experiencing the same thing.

A user made a post and deleted it, asked for it to be reinstated and now the system keeps deleting it (the whole Topic since it is the first post).

We could move the contents into a new Topic, but then anyone following the original URL will be taken to a page not found page…


Can we repro this Monday @tshenry?


Hi @AstonJ

Would you be able to confirm the repro steps? This is what I’m testing, but I want to make sure it sounds right to you?

  1. User creates topic
  2. User deletes topic
  3. Topic goes into scheduled delete status:
  4. Topic is automatically deleted after 24 hours
  5. User asks staff for topic to be reinstated
  6. Staff member finds deleted topic and restores
  7. System deletes after restore

If there’s anything I should be doing differently, please let me know.


Hi Taylor - the topic was posted back in April, but this seems to have happened:

  1. User creates topic by hitting ‘submit’ (so topic template is posted - which they said they couldn’t edit)
  2. User posts content into a second post then deletes the first post
  3. First post goes into scheduled delete status
  4. User queries this with staff, worried whether the whole Topic might disappear
  5. Staff member restores first post, copies contents of second post into it then deletes second post
  6. Topic is active with posts from April 08 to April 17
  7. System deletes topic some time after that (not sure exactly when) Edit: one of the mods has put that the system deleted it on July 7

It’s only when the user posted asking where their Topic was yesterday that we discovered this is happening.

If you need anything else just let me know (this is the Topic that keeps getting deleted btw).


Hmm. I’m not sure I fully understand what’s going on in step 1, but assuming the bottom line is that a user created a topic, step 2 appears to be impossible. If I create a topic as a normal user, make a reply to it, then try to delete my first (topic) post, the first post will not be marked for deletion which is by design.


In my case it went like this:

  1. User creates topic
  2. Deletes it
  3. I undelete it
  4. After awhile it becomes deleted again

I’m not sure of the timeframes.


I can confirm same thing happened for me multiple times.


So from what I can tell, staff do not have an “undelete” button available on the normal user’s topic when it has been scheduled for deletion. Only the original poster can undelete the post during the wait period. When you say you undelete it, do you mean after the auto-deletion occurred?

1 Like

Ah yeah sorry Taylor! I’m guessing then they deleted the first post then made a second post - which I think is possible iirc.

1 Like

Here’s what I came up with:

  1. User creates topic
  2. User deletes topic post, scheduling deletion (I changed the delete_removed_posts_after site setting to 1)
  3. Topic is deleted after specified time
  4. Staff undeletes topic and reverts to the original version of the post (only restoring will bring the post back with the “topic withdrawn by author, will be automatically deleted in 1 hour unless flagged” message)
  5. Topic will re-delete after some time

What’s happening: When a user deletes there own topic post, there is a property called user_deleted that gets set to true. There is a background job called DestroyOldDeletionStubs that runs every 30 minutes. This job runs the PostDestroyer.destroy_stubs function which will search the database and delete any posts that have user_deleted set to true along with an expired “deletion timer.”

The problem: When staff restores the post, user_deleted never gets set to false, so the next time DestroyOldDeletionStubs runs, the post will be re-deleted.

The solution: I’m pretty sure we will need to add some logic to the staff_recovered function that will set user_deleted to false (user_recovered already does this) See

The quick fix: Restore the topic post and get its post ID, then go to your rails console and run:

Post.find_by_id(POST_ID).update(user_deleted: false)

The post ID can be found easily by appending .json to the end of a topic URL. So using this topic as an example: The topic post ID is 632362.


Aha we should fix @eviltrout

Great detective work @tshenry!


Nice job Taylor :slight_smile:

For anyone else needing the above you will need to undelete the post/topic first, otherwise the find returns nil.


I’m still seeing this experience. Has this work to set user_deleted to false gotten any traction?

Is there a quick fix or workaround for hosted instances?


I’d say:

  • make your user staff
  • impersonate him/her
  • recover said post
  • “unstaff” the user

This ended up slipping through the cracks!

I am going to look into setting user_deleted to false when staff restore a topic.