Moderator Extension


(Angus McLeod) #1

This plugin allows you to create a category-specific workflow for moderators. It’s a work in progress. I’m posting it here now, as there are probably aspects to moderation I don’t understand or appreciate and I’m hoping to get some feedback.

This plugin does not, in any way, restrict a moderator’s powers to specific categories.

Restricting moderator powers to a particular category is the subject of this specification. If it is to be done, it will be done by the Discourse team, as it would be far too complex and unsustainable to do in a plugin.

I have said a bit more about why I think this plugin makes sense here. In short, for my purposes at least, if I were worried that a category-specific moderator would ‘overstep their bounds’, then they probably shouldn’t be a moderator anyway.

For me, category-specific moderation is more about focusing a moderator’s attention on a particular category. This more limited goal can be achieved much more easily than full-blown restriction.

Current implementation:

  1. Allows moderators to be assigned to a category in the category settings.
    51 PM

  2. When a moderator is assigned to a category:

    1. The ‘moderation’ notification count on their hamburger icon will only be for flags specific to the category they have been assigned to (currently does not include posts pending approval - see below).

      07 PM

    2. In their ‘Flags’ UI there is an additional category-specific list that only shows posts flagged in their assigned category

To do:

  • Apply the same treatment to Post Approval, i.e. create a separate count and make a distinction between assigned-category and ‘All’ in /queued-posts.

  • Update the email reminders for flags and post approvals so that moderators assigned to a category do not get reminders about flags and posts outside of their category.

  • Probably more. Suggestions welcome.

Feedback and pull requests are very welcome. Moderation is a significant responsibility that I know little about.


Category-Specific Moderators, phase 1 RFC
Add moderator for specific category or subcategory
Advice needed for tailoring Discourse to my organisation
Permissions - Create / Reply / See. What about editing based on group and category?
Allow some users to Schedule Publishing
Reminder function for pre-defined trust levels
How to change Moderator's rights
(Angus McLeod) #2

I’ve updated this plugin in the following ways:

  • There is now also a separate count and list for queued posts if a moderator is assigned to a category.

  • Moderators who are not assigned to a category are automatically added to a group site_moderators (if they are removed as mods or they become category mods, they are automatically removed). This makes it possible to target a message at non-category moderators

  • Category moderators are not sent the general PendingFlagsReminder and the PendingQueuedPostReminder (these are sent to site_moderators instead)

The remaining to dos here are:

  • Sending category-specific PendingFlagsReminder and PendingQueuedPostReminder to category mods in place of the generic ones (which they are now excluded from)

  • Test suite.


(Diego Barreiro) #3

I get this error when trying to install this plugin:

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 11026 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:108:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"bundle_exec", "cmd"=>["su discourse -c 'bundle install --deployment --verbose --without test --without development'", "su discourse -c 'bundle exec rake db:migrate'", "su discourse -c 'bundle exec rake assets:precompile'"]}
dfd86aaa082d94631432802052927e243786c185ef6483319295d21158c728a8
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one

FULL LOG: Discourse Log - Pastebin.com


(Angus McLeod) #4

Thanks. It should bootstrap now.


(Diego Barreiro) #5

@angus Your plugin is broken :sweat:

Check this topic:


(Angus McLeod) #6

Thanks for the heads up. It looks like the admin flags routes have been refactored.

I’ve fixed the issue and tweaked the UX a bit too. There’s no separate category list now. A moderator assigned to a category just sees flagged posts and topics from their assigned category within the context of the normal flag lists.

(screenshot taken on my sandbox where plugin is live and working)


(Heather Dudley) #7

Thank you so much for this. This is exactly the plugin I need for my forum. We’re in the early stages of development, and haven’t implemented Discourse on our site yet, but I have the same needs as you. I don’t mind my moderators helping outside of their assigned categories, but I do need their attention on the right places.

I will be following this closely.


(Angus McLeod) #8

Great! The main thing this plugin needs to move forward is testing and input from someone who really needs it.

If you have the time, you could help me test it on my sandbox.

I’ve made two new categories:

If you could sign up two accounts on my sandbox, I’ll make each a category moderator in one of those categories, then flag and queue some posts in both with some dummy accounts.


(EW 👌) #9

I did installed your plugin and its work fine thank you for a great job :tada:

  1. When I visit the Settings/Groups and click on the Automatic tab, I could see that I have 19 site_moderators which is wrong. But when I click on site_moderators it’s showing the right number which is 2. I could replicate this every time I enter Automatic tab. ( I think something small need to be fixed)

  2. In the Category settings, to be able to assign a user to be a moderator for that category, he has to be granted Moderation in the Users settings. ( I don’t know if its required but this how its worked for me, otherwise I wasn’t able to select that user). But I’ve one case where I was able to give category moderation for a user without Grant Moderation! -for that I’m confused and I need your opinion & clarification on this, please.


(Angus McLeod) #10

Yes, this sounds like a bug, I’ll take a look tomorrow.

Yes, this is how it’s meant to work.

Interesting! Could you give me some more details on this user (anything different about them?) and what exactly you did (i.e. step by step) to give them category moderation without site moderation.

Thanks!


(Heather Dudley) #11

Thanks, I’m going to take you up on that!


(Angus McLeod) #12

We might hang ten on the testing for another day or so. :desert_island:

I did a deep dive on this plugin today and I’ve completely restructured it to make it more robust and extensible.

I haven’t entirely finished yet. I’ll follow up in the next day or so.


(Angus McLeod) #13

I’ve done a significant reworking of this plugin. I’ve changed it’s name to “Moderator Extension” to reflect a change of scope to include a variety of modifications to moderator functionality.

@hawk or @jomaxro could you update the topic title to “Moderator Extension”? Thanks.

The highlights of the changes are:

  • All moderator administration is now in /admin/users in a new “Moderation” section that appears if a user is a moderator. Like other settings in /admin/users, admins have read/write permissions and moderators have read permissions.

  • Moderators (currently) have two ‘types’: default and filtered. The key attributes of each of type is listed next to the ‘Type’ setting.

    • Default:

      • Standard Discourse moderator
    • Filtered:

      • Will only receive notifications and reminders about flags and queued posts for assigned categories.
      • Lists of flags and queued posts will be filtered by assigned categories.
      • Has all other powers of a standard Discourse moderator.
  • Moderators can now be assigned to multiple categories using the ‘Categories’ setting (see above screenshot). The significance of assignment to a category depends on the moderator type (see above descriptions).

  • When category assignments are filtering a moderator action list, like the flag lists, the filtering categories are listed.

  • As the description of the types states, all flag and queued post notifications and the reminder messages will reflect the moderator’s category assignments. This was true in the previous version, however this logic has been significantly upgraded to handle assignments to multiple categories.

  • You can now display a list of moderators assigned to a category above the topic list(s) for that category. There are both site-wide and category-specific settings for this.

    Screenshot%20at%20Mar%2002%2020-47-18

Additional features contemplated:

  • ‘Restricted’ Moderator Type. The deeper I got into this plugin, the more ambitious I got. A
    ’restricted’ moderator type feels more doable now that I’ve laid some more of the groundwork. Something like:

    • Restricted (not currently implemented):

      • Will only receive notifications and reminders about flags and queued posts for assigned categories.
      • Lists of flags and queued posts will be filtered by assigned categories.
      • Powers concerning categories, topics, users and posts are restricted to assigned categories.

    The last item still contains a lot of work, i.e. most of the functionality described in “Authority” section of the Category Specific Moderators spec. I wouldn’t hold your breath for that spec to be fully implemented.

    Maybe there’s an interim type somewhere between ‘Filtered’ and ‘Restricted’.

  • Settings to control which admin routes are available to moderators

  • Category-specific moderator groups.

note: @ewanly (any existing moderator category assignments you made will be respected in the new system).

cc @Heather_Dudley


(Heather Dudley) #14

@angus This looks fantastic. I’m going to get on there today or this weekend and take a good, in-depth look.


(EW 👌) #17

I just had a chance to go through the changed plugin. Thank you @angus for all of your works and deep thoughts :angel:

In my use case, this will be the most important aspect and the main reason why I would use this plugin. I believe it will bring huge new use-cases to Discourse. I wish we could have it soonest :pray:


(Diego Barreiro) #18

I think this plugin is broken
“IP Lookup” button doesn’t work, same as dropdown


With safe mode it was working


I’ve disabled it and waiting for Discourse to compile, but logs pointed to this plugin


(Diego Barreiro) #19

Confirmed: I removed the plugin and now works

It seems like the plugin breaks the admin profile of moderators


(Angus McLeod) #20

Thanks for the bug report. This is now fixed.


(Dakota) #21

Having a bit of an issue with this. When I go to a category that has this enabled and moderators added, the “Moderators” text and avatars don’t appear without a page refresh. After that, they persist when I visit the index, until I refresh again. I only have “display moderators” enabled for a single category.

Anyone else experienced this? Could it be caused by incompatibility with another plugin perhaps? I installed a few at once but don’t see any errors in the logs so I don’t have much to go on besides guessing and checking.

Edit: Enabled it for a bunch more categories (all those that have moderators), issue persists. Doesn’t have to do with that. The setting also stays until a page reload when I switch from a category with this enabled to one with it disabled. Some kind of caching issue?


(Angus McLeod) #22

hm sounds like a property is not being properly observed. I’ll take a look at this tomorrow.