Hide flag actions for current user when they're flagged or the flagger

I apologize if this is maybe not the right place to ask. But it looks like it might be.

I would like to use I am guessing a boolean to compare say current user to 2 things in flag review. The Flagger and target of flag.

If current user = either it hides Flag review buttons ie Agree/Disagree/Defer etc… So flags can only be validated or dismissed by 3rdparty

I don’t believe you necessarily need a theme setting for this unless you want to add a setting to your component that lets admins turn on/off forcing flags to be handled by a third party?

Generally speaking, a plugin is needed if you want to modify default permissions like you described since themes/components can only make frontend changes and can be bypassed by users if they know where to look.

1 Like

Just looking to hide options. Sure a knowledgeable user could use browser to unhide buttons.

But this would work for my purposes to simply have it hidden for current user if they are the flagger or target of the flag. Just more of a deterrent of temptation(bandaid) than an end all fix.

From a quick look at the relevant code in core, you’ll need extend the canPerform property (which determines if the agree/disagree etc. buttons should be shown) in reviewable-item with your additional logic:

If you’ve never done something like this before, then the Developer’s guide to Discourse Themes would be a great place to get started! It covers how you can modify a core class which is what you need to do. Existing themes/components are a great resource that you can learn from as well, see the discourse-extra-group-classes component which uses the same technique that you’ll need to use (in particular the initialize-extra-group-classes.js.es6 file).

P.S. going to move these posts out of this topic since they’re not directly related to themes settings.

1 Like

Thank you will review and see what I can learn.