AgileVentures/LocalSupport — pull request #99 by johnnymo87 (2014-10-19 00:51:20+00:00)
Title: Invited user bugfix

Team LS reunite!

As we understood the problem, Rachel invited an "orphan org" to join, and then learned that the email used in this orphan invite process was out of date. When she updated the organisation's email, she found that the UI for this process didn't surface the new email, and she had no way to send this invitation over again.

The UI for doing this kind of invitation collects eligible emails on one screen, and then relocates them to another once they're invited. Under the hood, a `user` is created and associated with the organisation it was invited for, and it inherits its email from the organisation too. Emails on the pre-invite are organisation emails, whereas emails on the post-invite screen are user emails. The pre-invite screen doesn't allow the display of any organisations with associated users (hence the orphan surname).

We're solving this problem by unsetting the user-organisation association of the invited user. Note that this removes the user from the post-invite screen, because that screen displays the invited user along side the organisation it was invited for, which is now null.

I've also added a commit to surface delete buttons for users on the all users page, so Rachel can go delete that user with the out of date email is she so chooses.