FIX: Handle separately invite to topic and forum (PR #14562)

Invite is used in two contexts, when inviting a new user to the forum and when inviting an existent user to a topic. The first case is more complex and it involves permission checks to ensure that new users can be created. In the second case, it is enough to ensure that the topic is visible for both users and that all preconditions are met.

One edge case is the invite to topic via email functionality which checks for both conditions because first the user must be invited to create an account first and then to the topic.

A side effect of these changes is that all site settings related to invites refer to inviting new users only now.


Sounds good to me. Thanks for the explanation.

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