Disabled Uncategorized category is shown in mobile browsers when unlogged

AI-generated summary

The issue involves unlogged mobile users seeing the disabled ā€˜Uncategorized’ category on Discourse forums, while desktop browsers hide it — an inconsistency flagged by Ivan_Rapekas. jomaxro notes the discrepancy and questions whether it’s CSS or structural, prompting awesomerobot to suggest the category should be removed from HTML entirely when disabled. j.jaffeux debugs the issue, tracing it to a mobile/desktop divergence in category rendering logic tied to a desktop-only setting, which affects topic display and category visibility. He proposes adding awareness of the ā€˜allow uncategorized topics’ setting but acknowledges it’s misleading and not worth heavy investment. [sam](/t/-/81181/3, /t/-/81181/7) strongly advocates eliminating the ā€˜Uncategorized’ settings entirely, suggesting instead hiding its badge via CSS and letting admins delete the category outright — a simpler, cleaner approach. codinghorror clarifies this isn’t a bug: if topics remain uncategorized after disabling the category, they’ll still appear — the fix is to recategorize them. Ivan_Rapekas confirms recategorizing resolved the issue but notes the oddity that mobile unlogged users still see it while desktop doesn’t — highlighting the inconsistency despite the technical correctness.

Unlogged visitors able to see and access disabled Uncategorized category (only in mobile browsers!):

You may ensure that it does not appear in desktop browsers.

That’s strange, we’re definitely inconsistent here. We don’t show the uncategorized section on desktop but do on mobile when disabled via site settings. Is this CSS related @awesomerobot, or is it a structure issue?

Every bug I see about uncategorized just makes me want to remove the settings and special magic uncategorized sauce from Discourse. This has been plaguing us for 5 years now.

Nah, it should be removed from the HTML entirely when disabled. Not sure why the logic would be different here in one mobile template when it seems to work everywhere else…

I spent some time debugging this… and it was way more fiddly than expected.

https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/routes/discovery-categories.js.es6#L16

This line will be different from mobile and desktop, resulting in a false on mobile as is very rightly showing the name of the setting: ā€œDESKTOP category page styleā€.

In the end this code is never using any Uncategorized related site setting. But this difference in style will in one case trigger this or not: discourse/app/models/category_list.rb at main Ā· discourse/discourse Ā· GitHub
Which will then make displayable_topics blank in one case and not the other discourse/app/models/category_list.rb at main Ā· discourse/discourse Ā· GitHub
Resulting some category being deleted on desktop and not on mobile.

So we could add some knowledge of allow uncategorized topics but the name seems misleading (is there another setting to use for this?) and then I don’t think we want to spend so much time on this as it’s kind of an edge case and not so bad, and still making us spend more time on ā€œUncategorizedā€.

@sam Maybe we could make it pr-welcome?

This only big thing I support at this moment is deleting that site settings and shipping with a CSS rule that hides the badge from pre-seeded uncategorized slug.

Then all we need to do to remove uncategorized is delete it which makes much more sense rather than the huge amount of uncategorized contortion we have today.

Not a bug.

If you ā€œdisableā€ uncategorized but have not assigned a category to all the previously uncategorized topics, then.. well, this is as expected. Recategorize the ā€œwelcome to cuba forumā€ topic.

Hi @codinghorror,
Thank you for your attention to this problem! My fault was leaving my topic uncategorized while I disabled uncatecorized topics at all. After recategorizing this category has disappeared, as expected. Anyway, that’s weird, when desktop browser does not show the stuff, but mobile browser does and only for unlogged users.