I can't delete a category or topic description

I have no clue what happend but for some reason i just can’t delete category or its topic…

1 Like

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.

3 Likes

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:

obraz
obraz

Logs:

Details:

TypeError: Cannot read property 'reopen' of undefined
at https://XXX/t/XXX/17:193:22

and

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?

1 Like

It wasn’t generated by the plugin, i created this category by myself. But good try tho :confused:

1 Like

Topic seems to be archived but not closed. Maybe you need to “Unarchive Topic” or “Close Topic” before you can delete it?

The javascript error might require a full page reload to go away.

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 :confused:

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
[1] pry(main)> Rails.env.production?
=> true
[2] pry(main)> Category.connection
=> [snip]
[3] 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.

1 Like

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.

2 Likes

Oh, okay. The problem is here’s no anyone from team. Just no answer or smth like that :frowning:

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?

4 Likes

Yeah, that’s what I see:

obraz

That message doesn’t look the same as the one I put a screenshot of…

What version of Discourse are you using?

1 Like

obraz

1 Like

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?

1 Like
  • 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 /sidekiq/scheduled, find Jobs::CategoryStats, and “Trigger” it. Refresh your page and try deleting the category again. Does that help?

2 Likes

I was actually doing this deletion in the console to solve this problem… But I tried your hint anyway, and it didn’t help :confused: