How to enable reactions only for certain categories?

What would be the best approach to enable/disable this on a per category basis? We’d like to have a more complex “polis-like” mechanism in some selected areas of our social intranet, but don’t want to detract from the welcoming and positive nature of “just likes” for the rest of the categories.

3 Likes

There is no such feature. A quick way to do it would be to hide the reactions selector with CSS, such as:

.category-general-resources .discourse-reactions-picker {
    display: none;
}

If you want to iterate through multiple categories and make it easier to maintain, you can use a SCSS loop like this:

$categories: 'general', 'site-feedback', 'staff';

@each $category in $categories {
  .category-#{$category} .discourse-reactions-picker {
    display: none;
  }
}

The category class is visible in the <body> tag.

It can be circumvented by any user that knows how to make it visible again client-side, but if your community is well-behaved, I think it’s a good workaround. :slight_smile:

8 Likes

Have you looked at some other options in discourse to achieve what you want, such as:

5 Likes

This worked surprisingly well, thank you very much for this approach.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.