I was able to run through it quickly just now and repro the same results.
- Create a category with an admin user
- Revoke their admin status and delete the user
- The “About” topic for the category is soft-deleted when the user is deleted
- Attempting to undelete/restore the topic doesn’t work
- Changing ownership does technically work, but the topic remains in a strange deleted state no matter what you do from the UI.
From the console it looks like the posts record that is associated with the topic is deleted when the user is deleted. The topic record has a lot of 0’s when looking at various post related attributes.
It might be worth having an engineer see if we can be a bit more graceful here, but I suspect it’s easier said than done.
I was able to come up with a workaround to get back into a good place, but I had to use the command line. @jrivettcsa I would recommend taking a backup before you try this:
Values needed
-
Category’s “About” topic ID
Given https://example.com/t/topic/1827, that would be1827 -
Category’s ID
Given https://example.com/c/category-slug/5, that would be5
Be sure to copy any of the content of the About topic you want to use later into a notepad or similar, then proceed with the following:
Enter the rails console
cd /var/discourse
./launcher enter app
rails c
Replace <ABOUT_TOPIC_ID> in the command below with the Category’s “About” topic ID, then run to hard-delete the broken topic.
Topic.where(id: <ABOUT_TOPIC_ID>).destroy_all
Press the q key to get back to the console if needed
The category is still associated with the bad topic, so we need to clear that out. Replace <CATEGORY_ID> in the command below with the Category’s ID, then run.
Category.where(id: <CATEGORY_ID>).update_all(topic_id: nil)
Press the q key to get back to the console if needed
Exit the rails console and run following rake task to create a new About topic for the category:
exit
rake categories:create_definition
Now that category should be fixed! You can rinse and repeat as needed.