Lost ability to create new topics

AI-generated summary

Users reported an issue after updating to a recent commit in the tests-passed branch, where the new topic composer fails to load due to a JavaScript error: TypeError: undefined is not an object (evaluating 'category.topic_template'). The issue stems from SiteSetting.general_category_id being set to -1, which causes the composer to break when no ‘general’ category exists. cwhatley identified the root cause and suggested setting a default value of nil for general_category_id. darkpixlz confirmed the issue, noting that the category box is blank and the composer fails when ‘uncategorized’ is disabled. Don shared a workaround using the Default Composer Category component. A fix was later merged by blake, resolving the issue, as confirmed by darkpixlz.

I self-host using docker and update from the tests-passed branch.

Updated to the following commit - ff42bef1b6 - which includes the following PR:

https://github.com/discourse/discourse/pull/18383

After installing, users are unable to bring up the new topic composer either by clicking “+ New Topic” or visiting /new-topic directly.

Javascript error on console:

TypeError: undefined is not an object (evaluating 'category.topic_template')

I suspected that the code in the PR might be at issue and went into the rails console and executed the following to set the general category is to one of our existing categories:

SiteSetting.general_category_id=5

This fixed the issue. The prior value was -1.

I believe that using a default value of nil for general_cateogory_id would fix this issue.

5 Likes

How old is your installation?

Did you have a category named “general” that you created, or was it automatically created?

2 Likes

Our installation is about 18 months old, but we are current with the tests-passed branch.

We have no “general” category at all.

2 Likes

With the general category commit, users on my forum now see then when clicking New:


The category box is blank because there isn’t a General category, and Uncategorized is disabled.

When attempting to create a topic I get this

3 Likes

Same here. Users had to choose a category before they can write. Now I install the Default Composer Category component while the fix is coming so the category will not be empty when open composer. :slightly_smiling_face:

4 Likes

Okay, a fix for this has been merged in! :wrench:

https://github.com/discourse/discourse/commit/6affbabfd3a09c09b8800a8b0f81f2a07498c2fb

9 Likes


Much better now!

1 Like