More concretely, I think it may make sense to work towards a design where a subscription is analogous to a user’s notification preferences. But instead of the user_id being the key, the Slack channel would be the key.
Each Slack channel would have at most 1 subscription.
So a given filter would be something like:
{
key: '#channel'
val: {
watching: {categories: [], tags: []},
following: {categories: [], tags: []},
muted: {categories: [], tags: []},
}
}
Updating a channel’s subscription would just mutate one record, and the code would enforce that a given category or tag can only belong to one of the respective lists. Notifications would match topics to a subscription filter based on whether the category OR any tags match, and continue to use the existing logic for precedence of muted over watching and following.