DEV: Show message when cannot invite user to PM (PR #10336)

When inviting a user to a PM return a message that says, “Sorry, this user can’t be invited.” if they have been muted or are not in a users allowed pm users list.


Both of these exceptions return the same thing so you could handle both on one line with a comma.

Could we also return early if invited_by.staff?

    not_allowed: "Sorry, that user can't be invited."

(consistent with the translation above it.)

        not_allowed: "Sorry, that user can't be invited."

(consistent with other translations above)

Actually I think not? Here is a scenario: A conversation between StaffA and UserB has started. UserB has allowed_pm_users enabled and only has allowed StaffA and UserD. StaffA invites UserC, but UserB hasn’t allowed them so they can’t be added to the pm.

That is an interesting edge case. I kinda feel like staff should be able to say “do this anyway” but I also see your point of view. Let’s keep it your way and see how it goes.