Can't recover a topic by a deleted user

We had a moderator accidentally delete a user who posted a topic instead of the one who posted spam at the end of it… aside from the badness of not being able to undo deleting the user this caused the first post of the topic (i.e the topic itself) to end up in a deleted state. assigning the topic to a new user left the first post in the topic in the deleted state with no way to recover.

the lil trash can icon under the post would let me delete the entire thread and then the undelete icon would come up and let me undelete the whole thread. after doing that the first post was still stuck in the deleted state.

I ended up undeleting the first post manually via the api which fixed the problem.

however it would be nice if it was possible to fix this via the UI. i.e the undelete button should probably have been available on the first post when the thread was not deleted but the first post was. if that isn’t reasonable perhaps undeleting a thread should also undelete the first post in the thread if it is in a deleted state.

3 Likes

In many ways, the first post of a topic is the topic.

When a first post of a topic is spam, I usually delete using the topic wrench as opposed to the post wrench. I have noticed that other moderators at times delete by using the post wrench on the first post, but have not noticed any ill effects. It sounds like you may have uncovered a problem. (possibly a can of worms)

Can you list the exact steps needed to reproduce this?

1 Like

I’m not entirely sure what the moderator did. All I know is that the log shows the post+user being deleted. possibly deleting the user caused the post to be deleted?

Yes, deleting a user will cause all posts and topics by the user to be deleted - topics must be associated with a user.

This is a strange state for a topic to be in, and at the moment there doesn’t appear to be a way to undelete the topic. Even changing post ownership then attempting to undelete doesn’t work.

3 Likes

changing the owner of the topic then using the API to undelete the first post worked for me, not really practical for a regular moderator tho :stuck_out_tongue:

4 Likes

Good to know. We should make it work in the UX, shouldn’t need the API to resolve this.

5 Likes

Other than UX changes, I’m thinking it might be a good idea to have the admin-user deleteAllPosts check to see if the post number is the first and delete the topic instead when it is the OP

1 Like

I just ran into the same issue. :frowning:

This works now - we were able to recover topics by a deleted user. Discourse changed ownership to the system user.