(Obsolete) Set category tracking level defaults historically

That sounds about right :slight_smile:

Thanks to everyone here for helping me. For those playing at home, here’s a summary of the last 15 posts or so.

How to make all users watch (or unwatch) a specific category through the rails console

Set your parameters:

# Levels → :tracking :watching :watching_first_post :muted
level = :watching
category_slug = "announcements"

And then, to make everyone watch (or whatever level you set) this category:

User.all.each do |user| CategoryUser.batch_set(user, level, [Category.find_by_slug(category_slug)]) end

Or to make everyone unwatch (or whatever level you set) this category:

CategoryUser.where(category_id: Category.find_by_slug(category_slug), notification_level: CategoryUser.notification_levels[level]).delete_all

And there you have it! :tada:

:warning: Warning: unlike the OP, this is a destructive change in the sense that it disregards users’ current settings.

7 Likes