Moderator cannot create categories even when setting is set to allow it

AI-generated summary

In a Discourse forum running v2.3.0.beta4, moderators were unable to create new categories despite the setting “Allow moderators to create new categories” being enabled. Clicking the “New category” button caused a JavaScript error: Uncaught TypeError: Cannot read property 'name' of undefined, traced to the absence of the “everyone” group in the moderator’s group array — present for admins. The issue affected both LDAP-synced and manually created moderators. sam identified and fixed the bug, advising users to trigger EnsureDbConsistency via https://yoursitename/sidekiq/scheduler to apply the fix, which may take up to 8 hours to propagate. mav85 confirmed the fix worked after running the task, restoring moderator category creation functionality. This was a regression in newer Discourse builds, not a misconfiguration.

We’re using the latest build of Discourse, v2.3.0.beta4 +1.

Allow moderators to create new categories

… is checked.

Within the past week, our moderators can no longer create new categories. When they click on the “New category” button, nothing in the UI changes. If the same moderator user is granted Admin, New Categories works. There is an error in the console when the moderator clicks on New Category…

Uncaught TypeError: Cannot read property 'name' of undefined
at n.createCategory (_application-8b9e7ef3c422f949525bde041ba41eb96a8bab647b5154830601f1cf93d8c4cb.js:57034)
at e._join (_ember_jquery-716f4989c2eb49ad65163ffb56185407340c2b195b81b9392b62cde3e992cade.js:27473)
at e.join (_ember_jquery-716f4989c2eb49ad65163ffb56185407340c2b195b81b9392b62cde3e992cade.js:27235)
at Function.u [as join] (_ember_jquery-716f4989c2eb49ad65163ffb56185407340c2b195b81b9392b62cde3e992cade.js:16206)
at _application-8b9e7ef3c422f949525bde041ba41eb96a8bab647b5154830601f1cf93d8c4cb.js:54982
at n.mutateValue (_application-8b9e7ef3c422f949525bde041ba41eb96a8bab647b5154830601f1cf93d8c4cb.js:2229)
at _application-8b9e7ef3c422f949525bde041ba41eb96a8bab647b5154830601f1cf93d8c4cb.js:6134
at e.invoke (_ember_jquery-716f4989c2eb49ad65163ffb56185407340c2b195b81b9392b62cde3e992cade.js:26887)
at e.flush (_ember_jquery-716f4989c2eb49ad65163ffb56185407340c2b195b81b9392b62cde3e992cade.js:26790)
at e.flush (_ember_jquery-716f4989c2eb49ad65163ffb56185407340c2b195b81b9392b62cde3e992cade.js:26963)

Walking through the code and comparing when the admin successfully creates a new category and when the moderator does not, I notice that the “everyone” group is not listed in the groups array for the moderator, causing the undefined exception.

I couldn’t paste two images as a new user but below you’ll see the top part of the image where the groups array does not include “everyone” and an exception is thrown, and the bottom part where it’s included. The Moderator user is the top, the Admin is the bottom.

We have the LDAP plugin installed and working. However, users that are manually created within Discourse’s control and set as Moderator have the same issue.

Is there some setting that we messed up or could this be a bug in the newer builds of Discourse?

I fixed this last week, the tricky thing here is that you are going to need to wait a bit of time after installing the beta to get my fix to work (up to 8 hours).

Head to

https://yoursitename/sidekiq/scheduler and run EnsureDbConsistency for the fix to be applied.

3 Likes

I ran the EnsureDbConsistency trigger and moderators can now create categories. :sunglasses:

Thanks for the quick reply and the successful fix.

4 Likes