# Trading Buttons

**URL:** https://meta.discourse.org/t/trading-buttons/71308
**Category:** Plugin
**Created:** [October 3, 2017, 11:01am UTC](https://meta.discourse.org/t/trading-buttons/71308 "2017-10-03T11:01:07Z")
**Posts on this page:** 1
**Showing post:** 52

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [December 12, 2019, 1:14am UTC](https://meta.discourse.org/t/trading-buttons/71308/52 "2019-12-12T01:14:02Z")

</div>

> [@Gunnar](#):
>
> I have to admit, that `.destroy_all` part of the above command looks scary. What does it do, just remove the mute flag?

Any destructive actions run on the console are a little scary. Make sure you take a backup before running them.

A `CategoryUser` record describes a user’s notification level for a category. A `notification_level` of `0` means that the category is muted for the user. You can find more information here: [(Obsolete) Set category tracking level defaults historically](https://meta.discourse.org/t/how-do-i-set-category-tracking-level-defaults-historically/53165).

Deleting all `CategoryUser` records for a given `category_id` with a `notification_level` of `0`, will remove that category from the muted list for all users on your site.

When I run a command like this, I usually add an extra step that I didn’t post above. Instead of running

```ruby
CategoryUser.where(category_id: c.id, notification_level: 0).destroy_all

```

in a single step, I’ll assign the records to a variable so that I can double check that I’m dealing with the correct data. Something like this:

```ruby
# Get the category and assign it to a variable
c = Category.find_by(name: "<your category name>")

# Assign the category_users to a variable and examine the data. Make sure the records have the
# correct category_id etc.
muted_category_users = CategoryUser.where(category_id: c.id, notification_level: 0)

# When you are certain that the data is correct run
muted_category_users.destroy_all

```

---

_[View the full topic](https://meta.discourse.org/t/trading-buttons/71308)._
