FIX: "Sorry an error has occurred" was shown when flagging a post (PR #10948)

GitHub

This pull request has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/sorry-an-error-has-occurred-everytime-i-flag-something/167482/6