New topic not defaulting to uncategorised

Hi,

When one of my users(‘leader’ role) tries to create a new topic, the category is blank, and if they click the create topic button they get a 404 error:

When I (staff) try to create a new topic I still have the blank category, but I get a You supplied invalid parameters to the request: category error

I’ve found a setting:

Allow topics to be created without a category. WARNING: If there are any uncategorized topics, you must recategorize them before turning this off.

I done remember enabling it but it is enabled - I believe it is a default but I’m not sure.

I had a look at the uncategorised category settings:

This category is special. It is used as the default category for new topics that do not have a category selected. If you want to prevent this behavior and force category selection, please disable the setting here. If you want to change the name or description, go to Customize / Text Content.

In the short term I’m worried that our users are having a bad experience and unable to post. (404 error)

I’ve tried searching meta.discourse.org to find answers to my questions:

Question 1: Why is the category field blank when I try to create a new topic? (it is not blank when I post to meta.discourse.org)

Question 2: If ‘Allow topics to be created without a category.’ is enabled - why am I getting an error? (I suspect ‘Uncategorised’ actually means ‘without a category’, but it is described as '[…]the default category for new topics that do not have a category selected. ’

I actually like the behaviour of meta.discourse.org; where is defaults to ‘general’ instead of uncategorised but I’m not sure which is right approach;

a) renaming ‘Uncategorised’ to ‘general’. (note: I found a post - from 2016 - that indicated this was a bad idea, and equated ‘Uncategorised’ with ‘null’ in the database.)

OR

b) Creating a ‘general’ category, moving all uncategorised to ‘general’(how?), setting ‘general’ as the default of new posts, and disabling ‘Allow topics to be created without a category.’

Any advice - or pointers to the relevant documentation are appreciated - is appreciated.

best regards

Stephen

PS FWIW we are a OSS project and this is a free discourse instance kindly provided by the nice people at https://www.discourse.org

I also noticed this. But I have disabled uncategorized but it should still select the top category in that case. It’s showing the same (empty) category field as default.

1 Like

Thanks @MarcP!

I think this might be a bug, but I didn’t want to pre-judge.
s.

Hey Stephen,

Which version of Discourse is your site running?

The uncategorized “category” was recently replaced by a new general category. Has a new category of that name appeared on your site? Did you have a general category previously?

Yes I had a general category before. Running the most recent build but noticed it since, a few weeks?

Yes this seems to be recent behaviour for me too.

This should have been fixed by this commit, but I can see that your site has alrady been updated to include it:

There’s a chance it hasn’t covered every case. We’ll get someone to look into it. :+1:

5 Likes

Hmm, when I enable allow uncategorized topics the uncategorized category still appears on my category page. Even after I renamed my general.

The Uncategorized category is not a default site setting now since when General category is enabled on Discourse. On the new Discourse installs there is a default General category. So when you open the composer the automatically selected category is General. However on older installs where you haven’t general category, I think any category can be the general category. I think it is just means in this case the composer default category. So that won’t be enough if you create a category with General name. You have to set up the category id with the hidden site setting general_category_id too.

For example:
If you create a new category for this General purpose. The category name can be for example: General and you should check the category id as well. Now in this example it will be 9.

The category created successfully but if you open the composer it won’t be the default category so let’s set up the hidden site setting.

Set up category_id to general category

Note: category_id=9 is just in this example the correct category id. Your newly created category probably have a different category_id number.

cd /var/discourse
./launcher enter app
rails c
SiteSetting.general_category_id=9
exit
exit

After this, when you open the composer the category_id=9General category will be the default.

2 Likes

Have you rebuilt since renaming general?

We have not renamed general - we only have ‘uncategorized’ and we have not renamed it.

Discourse updated: 14 hours ago

we are a OSS project and this is a free discourse instance (kindly provided by the nice people at https://www.discourse.org) so upgrades happen automatically without our intervention

Category still comes up blank

@Don

Thanks - this is a hosted instance so I’m not aware of a way to get shell access to set the hidden site setting.

Best

Stephen

1 Like

It’s the weekend for most of the Team, but we can fix that up for you as soon as someone is available. :slightly_smiling_face::+1:

4 Likes

I just want to make sure - so I can minimise disruption to end-users:

  1. do I need to create a ‘General’ category in preparation ?

  2. Will I need to move all topics with the category ‘Uncategorised’ to general after the config change is made?

Thanks for your help

Stephen

If you’re aiming for this outcome rather than #uncategorized as your deafult you should be safe creating a new #general category, moving all of your #uncategorized topics into it using the bulk tool, and then disabling allow uncategorized topics in your admin settings in preparation (though this won’t fix the dropdown).

However, this will only take a Team member a couple of minutes to fix up along with manually updating your hidden general_category_id setting so you may just want to wait. :slightly_smiling_face:

4 Likes

Thanks, this explanation is very good and I got it sorted. I think this topic should be in support as it’s not a bug and I suggest your reply should be marked as solution.

1 Like

Just so I understand

  • New instances of discourse have a General category that is the default when posting a new topic.

  • our instance comes from a time when the default was the ‘uncategorised’ category.

The fix is to set the SiteSetting.general_category_id to the Uncategorised category ID

This command:

SiteSetting.general_category_id=<new category id>

  • Instances that still have the Uncategorised category should set the above setting when upgrading
1 Like

All sorted. We moved to using ‘General’ instead of uncategorised and the system correctly provides a default category.

Thank you to everyone who helped diagnose this issue, and special thanks to @fzngagan for sorting it out so quickly and professionally.

best regards

Stephen

5 Likes

For anyone that happened to manually deleted the seeded General category before this fix

There is now an additional fix that will clean up the SiteSetting.general_category_id if it is set to a category that doesn’t exist:

3 Likes