FEATURE: add penalty options for take action (PR #10926)

Add the ability to silence or suspend users from the “take action” button when moderators are flagging posts. This allows for a more streamlined active moderation workflow, when moderating against a topic directly.

Screenshot from 2020-10-14 16-49-44


should be done in init, this will leak

don’t think this intermediate variable is very useful

what is the goal of this promise here ?

One thing we did when migrating to the review queue was to have the server side pass back all the actions you could take. This was done to help people integrating with the API because they didn’t need to know all the actions on the client side.

Since this is the front end, and a very specific thing (take action) maybe this approach is OK. I just wanted to bring it up in case you had any thoughts about it.

I’m happy to approve this but Joffrey’s feedback should be addressed too.

The admin tools one? It’s also declared like this elsewhere previously - I can remove all instances of that here :+1:

The promise is necessary for silence/suspend. It’s used in a callback in the before() option for penalty-controller.js, called here - https://github.com/discourse/discourse/blob/master/app/assets/javascripts/admin/addon/mixins/penalty-controller.js#L57

Yeah, I initially wanted to query for flagging options, but I didn’t see a better option here when I began. My main goal here was to re-use the same widgets we had set up for the review queue.

I went with setting things up through client-side, because there’s no reviewable flag to query at the time of flagging. Perhaps one alternative approach would be exposing a way for reviewables to send down a sample of their actions (like this) without having to create an instance of a reviewable?