I have installed your plugin, but it doesn’t seem to work…
I’ve followed instruction here Install plugins on a self-hosted site
After installation Discourse works fine, but it seems nothing changed: if I look at users’ profiles of the group I wanted to force to watch a category, nothing changed, the category doesn’t appear among the watched ones.
This is my fork, maybe I did some mistakes…?
# name: Watch Category
# about: Watches a category for all the users in a particular group
# version: 1.0
# authors: Jared Needell
module ::WatchCategory
def self.watch_by_group(category_slug, group_name)
category = Category.find_by(slug: category_slug)
group = Group.find_by_name(group_name)
return if category.nil? || group.nil?
group.users.each do |user|
watched_categories = CategoryUser.lookup(user, :watching).pluck(:category_id)
CategoryUser.set_notification_level_for_category(user, CategoryUser.notification_levels[:watching], category.id) unless watched_categories.include?(category.id) || user.staged
end
end
def self.watch_all(category_slug)
category = Category.find_by(slug: category_slug)
User.all.each do |user|
This file has been truncated. show original
1 me gusta