Uncategorized showing up on mobile

I’ve got a site that has allow uncategorized topics disabled, yet uncategorized shows to a logged out (oh, or logged in as admin) user on Android mobile. I just did a rebuild. Theme components don’t explain it. The problem persists in Safe-Mode. Only official plugins are installed.

I don’t see the problem on Desktop.

https://www.druidforum.org/

1 Like

Did you flush out all the topics from the uncategorized category?

3 Likes

Yeah! It’s just the about topic, no others. I can’t quite make sense of how it could even be possible with the specs that I assume are in place. And it’s just mobile,not desktop.

2 Likes

Can we repro this @tshenry? Sounds like mobile only?

3 Likes

I don’t believe we expect the About topic to remain in Uncategorized when it’s disabled. The warning in the allow uncategorized topics site setting description says (emphasis added):

WARNING: If there are any uncategorized topics, you must recategorize them before turning this off.

Can you try moving the About topic to an active category? That seemed to work on my test site.

2 Likes

Ah. OK. That fixed it.

That’s quite confusing, as it’s normally verboten to delete an about Topic (but I guess it’s not really an about topic because it’s not really a category). But I did, and now Uncategorized doesn’t show anymore. And I had to do it on my phone, because I otherwise couldn’t find it.

Uncategorized is very confusing since it’s NOT a category. I really think it should be off by default.

1 Like

No, because I don’t believe in forcing an artificial Animal, Vegetable, Mineral classification on every single instance in the world right out of the gate. Sorry.

Do heed the warning that is in there for a reason:

WARNING: If there are any uncategorized topics, you must recategorize them before turning this off.

That being said, can we normalize this behavior @zogstrip so it’s consistent between mobile and desktop?

Yeah. I understand that argument, and used to agree, but I think a default category would make more sense than a not-category. But I will try not to suggest that again unless, perhaps, we’re one day in the same space with :beer: .

@nbianca can you add to your list to investigate why the uncategorized was showing on mobile when it wasn’t showing on desktop?

4 Likes

On desktop we show categories and topics separately, but on mobile we show categories with topics, combined. Keeping that in mind, it is this line that causes the bug:

https://github.com/discourse/discourse/blob/master/app/models/category_list.rb#L147

c.displayable_topics.blank? is always true on desktop because we load topics separately so displayable_topics is always blank. On mobile, it is true only if there are really no topics in that category.

We have two solutions here:

  • show uncategorized if there is at least a topic, no matter the value of ‘allow uncategorized topics’ setting

  • hide uncategorized even if there is a topic, if ‘allow uncategorized topics’ is false

The second solution is easier to implement because it means we simply remove the second part of the condition.

6 Likes

I think that hiding the topics that are in uncategorized is (strangely) less confusing than NOT hiding uncategorized when you turn on the setting. I think that if you turn off uncategorized, you’ll notice immediately that all those topics disappeared, but if nothing happens when you turn off uncategorized, then it seems broken.

2 Likes

Let’s go with the easier one because we are close to a release here and I don’t want to do anything too risky.

2 Likes

My vote here is “nuke as much special uncategorized code as possible”. The more we have the more confusing stuff gets.

So I would vote for:

show uncategorized if there is at least a topic, no matter the value of ‘allow uncategorized topics’ setting

Provided the implementation deletes special magic code from Discourse and we carry less edge cases around.

Basically pick the solution that deletes more code from Discourse.

1 Like

I submitted a fix for the bug in the first post:

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

I went with the first solution because that is the one that deletes some code from Discourse. The other one in fact added code to determine if there is at least one topic in uncategorized category.

I also reviewed all uses of category.uncategorized? and I found a few places that might not be necessary if we made Uncategorized less of a unicorn and more of a category:

https://github.com/discourse/discourse/blob/af6d0342b642feac3a5e359d13c854d2a80145b6/app/controllers/list_controller.rb#L372-L378

https://github.com/discourse/discourse/blob/3e7f7fdde8dd4ad92a34352ec927b2cdfbf91416/app/serializers/basic_category_serializer.rb#L43-L57

https://github.com/discourse/discourse/blob/eeaecd4fd2216f909e643554b0ee7f728944c2c4/app/models/category.rb#L898

These are some parts that do not interfere with other features, which makes the changes less risky, but still not easy.

6 Likes