This issue originally was created for the following reason:
This has bugged me for quite a while, but I thought maybe there was some legitimate use for this. But over time I realized it's just a bug and needs to be removed...
invite_by_email's invite_presave overrides the invitee if a user exists with the email address of the invitation. In both cases of when this code actually makes a difference, the behavior is not desirable:
1)
- User A sends invite to email address associated with EXISTING USER B:
X New invitation is created with invitee already set to user B2)
- User A sends invite to nonexistinguserb@example.com
- nonexistinguserb@example.com joins as userb without using the invite
- nonexistinguserc joins as userc using the invite
X invitee is set to userb instead of usercThe thing I *think* was intended was to catch cases where a user joins without using the invitation, and to match the user that way. But it's not achieving that goal anyway, and that would be best done in an invite_by_email_user_insert.
When I was reviewing the original patch I became frustrated because the code was more complex and difficult to understand than it needed to be.
Patch #6 fixes the issue and simplifies the code.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | invite_by_email_invite_presave-2626076-6.patch | 2.01 KB | SpartyDan |
| #3 | invite_by_email-invitee_override_fix_against_4.0beta2-2626076-3.patch | 707 bytes | captainack |
| #2 | invite_by_email-invitee_override_fix-2626076-2.patch | 694 bytes | captainack |
Comments
Comment #2
captainack commentedComment #3
captainack commentedCommitter please ignore this comment ;) #2 is the correct patch.
I just wanted to attach a patch against 4.0-beta2 as well, in case someone is pinned to it for a while.
Comment #4
socialnicheguru commentedI can't get either of these to apply to the dev version
Comment #5
socialnicheguru commentedComment #6
SpartyDan commentedI agree that
My patch includes rewriting the invite_by_email_invite_presave function.
I eliminated the use of entity metadata wrapper. IMO it increased code complexity and decreased readability.
I also reordered some of the code into a more logical order.
Please review and let me know if you encounter any problems.
I do not plan to commit this code until a couple of other people have reviewed it.
Comment #7
SpartyDan commentedComment #8
SpartyDan commentedComment #9
SpartyDan commentedPatch #6 committed.