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.

2 Likes

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