Where Can we find how many users are watching or tracking a topic or a category? Does it save any where in discourse?
There are “_user” tables.
Each has a
notification_level field where the integer indicates a members preference - 0 Muted, 1 Normal, 2 Tracked, 3 Watched
So a query something like this should work
SELECT COUNT(id) FROM category_users WHERE notification_level = 3 GROUP BY category_id
to give you how many are Watching each category.
How can I define a function in plugin.rb for using this code?
Can any body tell me what should I add to plugin.rb to access a function like
If you post a link to your GitHub repo others could look and offer suggestions / PRs
I think others will know better than I as to what the best approach might be. My take is that certain values are already available by making an XHR to get the JSON and when they aren’t a controller can be put together to return JSON eg.
I have seen plugins that use custom queries involving JOINs etc. but I have not experimented doing similar yet.