I have a category with a large number of subcategories, each of which may have a number of topic postings. Is there a simple way for me to remove all of the subcategories and cause the existing topic threads in the various currently existing subcategories to instead appear under the main category itself after the subcategories are removed? Thanks!
AI-generated summary
The discussion revolves around removing all subcategories from an existing category and reassigning the existing topics to the main category. L30110 is seeking a simple method to achieve this. sam suggests using the batch select tool, but L30110 finds this method ineffective and cumbersome.
dax proposes using the rails console with a specific command to bulk move topics from one category to another. L30110 is able to move the topics using the interface but is unable to delete the original category due to the subcategories. They also mention that moving the topics triggered unexpected notifications.
Bryan_Joseph shares a similar issue, where they believe they have deleted the subcategories, but Discourse still thinks they exist, as evidenced by the provided screenshots.
You can batch change categories by clicking on the batch select tool on the topic list and then re-assign categories to all the topics in one go.
That is the simplest way I can think of.
Hmm. Thanks, but that doesn’t seem to work, in fact it messes things up pretty badly. It only appears to impact the top-level category name, and leaves all the subcategories intact. It also only will apply to one item at a time, even when they’re all in theory selected! Which I definitely don’t understand. I can see how to probably do this one item at a time by switching each one to a new category name, deleting the original category with the subcategories, then recreating it without the subcategories and moving them all back in individually, but that is going to be VERY time consuming.
If you need to bulk move all topics from a category to another category you can use the rails console.
Topic.where(category_id: <from_category_id>).update_all(category_id: <to_category_id>)
Doing the move through UI, you are not able to select many topics (I think only the first 30 or so) so if you have many topics in a category you should repeat the move many times before finishing.
I was ultimately able to move the topics using the interface, but I can’t delete the original category because of the subcategories. I don’t see any obvious way to delete those. No doubt I’m missing something obvious. By the way, when I moved those topics, a bunch of notifications were sent out for those old topics. That was unexpected. Thanks again.



