I can't delete a category or topic description


(Sevos) #1

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


#2

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.


(Sevos) #3

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.


(Mittineague) #4

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?


(Sevos) #5

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


#6

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.


(Sevos) #7

Okay, it’s no longer archived and i closed this topic. I tried also move this to the another topic. Nothing helped :confused:


(Sevos) #8

How can I delete this category in the (rake) console?


#9

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.


(Sevos) #10

I’m the owner of this forum. How should I do it properly?


#11

I meant: a Discourse team member, who is more knowledgeable than me on this topic.


(Sevos) #12

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


(David Taylor) #13

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?


(Sevos) #14

Yeah, that’s what I see:

obraz


(David Taylor) #15

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

What version of Discourse are you using?


(Sevos) #16

obraz


(David Taylor) #17

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?


(Sevos) #18
  • 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


(David Taylor) #19

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?


(Sevos) #20

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: