Make sure that we don't duplicate Person instances with the *same-ish* email
Patchwork keeps attribution of patches by assigning them to a
Person model - something that is looked up / created basing on the email.
find_author() we look for a Person instance basing on their email:
person = Person.objects.get(email__iexact=email)
Sometimes we get:
Exception Type: MultipleObjectsReturned Exception Value: get() returned more than one Person -- it returned 2! Request data not supplied
Which leaves us with discarded emails...
However, exploiting the case sensitivity of mailbox local-parts impedes interoperability and is discouraged.
Tough call time: since most email services seem to treat the local-part as case-insensitive we should de-duplicate on our side.
Sadly there seems to be no sane way of having case insensitive fields or adding case insensitive unique constraint via Django.
figure out where were we
save()-ing Persons with different email capitalization without trying to look for them first
converge on using lowercase everywhere, e.g. via
- create a migration that deduplicates users
- write tests for the above