I have no clue what happend but for some reason i just can’t delete category or its topic…
Hi @sevos, I think you should provide more context into what you’re trying to do, which is your permission level, what the logs say, etc. Otherwise nobody will be able to help you.
When I try to delete a category, I get this error: “Can’t delete this category because topic count is 1.”. Okay, gotcha.
When I try to delete a topic, I can’t see this option:
TypeError: Cannot read property 'reopen' of undefined at https://XXX/t/XXX/17:193:22
TypeError: Cannot read property 'reopen' of undefined at https://XXX.XXX/t/XXXX/17/5:193:22
I have full admin rights.
I can see “o kategorii” which translates to “about the category”.
If the topic was generated by the Discord plugin, did you uninstall the plugin before trying to delete the topic?
It wasn’t generated by the plugin, i created this category by myself. But good try tho
Topic seems to be archived but not closed. Maybe you need to “Unarchive Topic” or “Close Topic” before you can delete it?
Another way would be to move the topic somewhere else so your topic count goes to zero.
Okay, it’s no longer archived and i closed this topic. I tried also move this to the another topic. Nothing helped
How can I delete this category in the (rake) console?
I don’t know exactly, you need to check with a team member, but you can at least see how it looks like:
root@demo ~ # cd /var/discourse root@demo /var/discourse # ./launcher enter app root@demo-app:/var/www/discourse# rails c  pry(main)> Rails.env.production? => true  pry(main)> Category.connection => [snip]  pry(main)> c = Category.find_by(name: 'Your Category Name')
Then you should be able to call
#destroy from there, but really, don’t do it without further confirmation from a team member because there might be other things to do in order to properly delete the category.
I’m the owner of this forum. How should I do it properly?
I meant: a Discourse team member, who is more knowledgeable than me on this topic.
Oh, okay. The problem is here’s no anyone from team. Just no answer or smth like that
Deleting the category from the rails console could have bad side effects, it would be better to delete the remaining topic from the user interface. The “About this category” topic cannot be deleted, and does not count towards the “topic count is 1” message. There must be another topic in the category.
When you click “delete category”, you should see a message like this with a link to the remaining topic:
Do you see that?
Yeah, that’s what I see:
That message doesn’t look the same as the one I put a screenshot of…
What version of Discourse are you using?
Can you list what steps you take to get that “Can’t delete this category” message? And include a screenshot of the whole page showing that message?
- Archiving the topic
- Deletion of all posts in the topic (action = post)
- Moving topic to another topic
- Deletion of the first post of a topic in the rails console (category description still indicates old content, but this isn’t visible in the topic)
- Update forum/rebuild of app
Ok, I suspect this is what has caused the issue. Generally changing stuff in the rails console is a bad idea, as it can cause unexpected problems like this. Let’s see if we can recover the issue though.
Try going to
Jobs::CategoryStats, and “Trigger” it. Refresh your page and try deleting the category again. Does that help?
I was actually doing this deletion in the console to solve this problem… But I tried your hint anyway, and it didn’t help