# "X new / updated topics" gets triggered for muted topics

**URL:** <https://meta.discourse.org/t/x-new-updated-topics-gets-triggered-for-muted-topics/36226>\
**Category:** Bug\
**Tags:** planned\
**Created:** [02.Декабрь.2015 02:51:19 UTC](https://meta.discourse.org/t/x-new-updated-topics-gets-triggered-for-muted-topics/36226 "2015-12-02T02:51:19Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [23.Май.2017 15:19:02 UTC](https://meta.discourse.org/t/x-new-updated-topics-gets-triggered-for-muted-topics/36226/10 "2017-05-23T15:19:02Z")

</div>

How can it do that?

- Post is created

- We trigger a message bus message to all groups with access to the topic informing that a new post is created

We would have hint that message to filter out all users that have the topic muted, that sort that out.

So, now what we have is:

```plaintext
 def self.publish_latest(topic, staff_only=false)
    return unless topic.archetype == "regular"

    message = {
      topic_id: topic.id,
      message_type: "latest",
      payload: {
        bumped_at: topic.bumped_at,
        topic_id: topic.id,
        category_id: topic.category_id,
        archetype: topic.archetype
      }
    }

    group_ids =
      if staff_only
        [Group::AUTO_GROUPS[:staff]]
      else
        topic.category && topic.category.secure_group_ids
      end
    MessageBus.publish("/latest", message.as_json, group_ids: group_ids)
  end

```

What we kind of want is:

```ruby
MessageBus.publish("/latest", message.as_json, group_ids: group_ids, server_filter: lambda do |user_id|
   return topic.not_muted?(user_id)
end
)

```

It has caveats cause it means that when people ask for the message we would have to issue a query, nothing in message bus works this way at the moment.

The trivial implementation does not work, cause the user\_id list can be gigantic

```ruby
MessageBus.publish("/latest", message.as_json, group_ids: group_ids, exclude_user_ids: user_ids_muting_topic)

```

This one _may_ sort of work,

```ruby
MessageBus.publish("/latest", message.as_json, group_ids: group_ids, exclude_user_ids: user_ids_muting_topic_seen_in_last_24_hours)

```

It is a 🌋 of worms.

---

_[View the full topic](https://meta.discourse.org/t/x-new-updated-topics-gets-triggered-for-muted-topics/36226)._
