Hide specific categories from the top page without muted or how to get new topic count in muted category

There are so many topics posted in my community in one particular category.

Sometimes people find it annoying and want to remove it from the home page.
However, even these users are not completely uninterested in those categories, nor do they want to use mute to block them completely.

So I came up with two approaches.
1: Place a checkbox on the top page to select whether or not to display a particular category.
2: Instead of muting that category, display the number of New Topics in the muted category on the home page. Users can immediately see the category by clicking on that particular category tab added to the navigation bar.

As a matter of fact, I could display the number of New Topics in 2, but I found out right after the completion of the component that I could not get the number of New Topics in the muted category… I forgot to check the muted category…

So I am considering approach 1 next, but I don’t know how the top page query works or how to hide certain categories…

Or even a solution for approach 2 (how to get the number of New Topics in the Muted category) would be fine.

Any help would be really appreciated.

1 Like

Hi @Programer-D
You can try GitHub - keegangeorge/discourse-hide-categories: This is a theme component that allows you to hide specific categories from either the hamburger menu or category boxes.
or CSS way.

Thank you very much.

The css was a blind spot, but I just tried a few things and it doesn’t seem to work very well.
I am not a native English speaker, so I guess I didn’t explain it well enough.
In the 1, the notification must be set below Normal and certain categories must be hidden.
In CSS, I can get the category class and hide it, but it seems to erase Watching and Tracking as well… I will try to find a way to give a class based on each topic’s notification settings.

Also, I did a little research and it seems that the ability to remove categories from the top was a heavily debated feature about 2 years ago and has been removed and replaced with mute.

I think those who were against replacing it entirely with a mute were right. Mute is a nice feature. But the gap between normal and mute is too large and mute leaves the category far behind.
Something in between would have been nice to have another notification setting.

I’ll give it some more thought…

I think there’s a plugin to replicate the old ‘suppress’ behaviour, if that’s any use?

Thank you very much.
I was just looking at an old discussion topic and there was talk of creating such a plugin and I was trying to find it.

I will try it as soon as I can.

1 Like

At any rate, it seems that by default, the display of all notification settings is suppressed.
This is still functional (although in hindsight, CSS is not bad too), but I will try to perfect it and see if it is possible to hide only normal and mute notification settings.

Since it’s a plugin, there seems to be room for improvement, so I’ve regained a little motivation. Thank you very much.

I am not a native English speaker

What is your native language? If Russian / Ukrainian - welcome to PM.
I will check more this evening regarding your issue.

One more idea - limit this category for particular group only and give users an option to join it when they need it.
Or to be joined by default and stop group participation when they don’t wont to see it anymore.

You can also edit CSS for different groups - so f.e. there can be a button to join this group easily.

I looked into the plugin a bit and it doesn’t look easy… I looked inside result = Topic::ActiveRecord and it doesn’t look like it contains any data related to notifications.

Furthermore, I wonder if it is possible to get the information for individual topics from here and get the notification_level.
I’ve created plugins that also involve some Ruby, but I’ve relied mostly on Javascript, so I don’t know much about Ruby.

Maybe… I’d like to foreach the contents of the “result” to get detailed information about each topic, and record the topic IDs of only those topics whose notification_level is “Tracking” or “Watching” and store them in the list, and add to the where clause “OR I imagine it would work well if you use topics.topic_id IN (#{topic_ids.join(’,’)”. I know it’s not very pretty code, and I’m not familiar with Ruby, so I’m not sure if it would work…

I’ll go find a way to call Topic by ID from Ruby.

Thank you very much.
I hadn’t thought about using groups…but if the current plugin modification doesn’t work, I’ll give it some thought.

I don’t understand everything at all properly, but somehow it worked.

In case anyone else wants to do the same thing, I’ll leave it here.

Line 17 of plugin.rb of the plugin that JammyDodger taught me.

result.where("topics.category_id NOT IN (#{category_ids.join(",")})")

to the

result.where("topics.category_id NOT IN (#{category_ids.join(",")}) OR tu.notification_level IN (2,3)")

The “Tracking” and “Watching” topics remain on the top page, but the “Nomarl” topic is hidden from the top page.
It took a while because I did not understand ActiveRecord properly, but if I had communicated the problem properly, it might have been an easy problem for you.

I’m not 100% sure I’m following this, but if you ‘default mute’ a category from the default categories muted admin setting, it sounds like that already does a similar thing? The topics won’t appear in the Latest list, but are all visible if you go to the category page. And if a user interacts with one so it becomes tracking or watching, then those ones do show up in their topic lists.

Is that what you’re after?

The mute was roughly meeting the requirements, but there was one problem: it was no longer getting NewTopics.

I created a component to get this topic count, but realized that Mute does not get NewTopics count because muted topic is not counted in NewTopics.

I created a component to get this topic count, but I noticed that Mute does not get NewTopics, so I could not get the number of new topics.

That is why I was looking for a way to prevent it from showing up on the top page with the notification setting Nomarl.

This may be a special situation. For a given category, there are an undesirable number of unread topics on the home page, while defaulting to Mute makes it difficult to notice new topics and drives users away from the category excessively. We didn’t want to do that because a large number of topics on the top page means a very thriving category.

Perhaps this is a problem that should have been solved by educating the users, but we wanted to do what we could anyway, and we are glad that we managed to meet the requirements.


Ah, I think I see now. I’m glad you found a solution that works for you. :+1::slightly_smiling_face: