"Queue for Review" button can error when flagging

A javascript error is thrown when trying to use the Queue for Review button on the flag modal when the post is hidden, or if you had already flagged the post in the past.

The error can be found in the screenshot below and appears to be pointing to this area of the code.

Repro for queuing a hidden post:

Repro for queuing a post you already had flagged:

For a fix, we’ll need to decide if the Queue for Review button should just not be rendered in those two scenarios, or if it should have the power to always send a post to the review queue.


I’m unable to replicate this issue until the same staff user already flagged that post. It is working properly if two different users are involved like in the above example.

I fixed the issue by disabling the button when the staff user can’t perform that action.