This snippet represents the code as it exists in QC now. Invitations have a send method on them which constructs an email based on the model instance's current values. The User.send_invite
method was originally written as a convenience method so that view code could create and send an invitation as a one-stop shop, optionally assigning roles as necessary. Similar things have been done for the registration, myemails, and postajob apps, so nothing is novel about this approach.
My concern with it, however (despite ironically being the person who implemented it in this instance) is that it becomes ambiguous which code should be responsible for sending invitation emails. In particular, I could easily invision someone forgetting that User.send_invite
exists, or deeming it inadequate as it also deals with roles, despite that field being optional. As such, one of the two methods is bound to get more advanced logic while the other bit rots. This is not simply paranoia, as they both already deal with