fix: case sensitivity for Subscribed.email (#5270)

This commit is contained in:
Robert Sparks 2023-03-03 09:05:17 -06:00 committed by GitHub
parent 963b1bd197
commit fce28e78f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -125,8 +125,8 @@ def create_account(request):
send_account_creation_email(request, to_email)
# The following is what to revert to should that lowered barrier prove problematic
# existing = Subscribed.objects.filter(email=to_email).first()
# ok_to_create = ( Allowlisted.objects.filter(email=to_email).exists()
# existing = Subscribed.objects.filter(email__iexact=to_email).first()
# ok_to_create = ( Allowlisted.objects.filter(email__iexact=to_email).exists()
# or existing and (existing.time + TimeDelta(seconds=settings.LIST_ACCOUNT_DELAY)) < DateTime.now() )
# if ok_to_create:
# send_account_creation_email(request, to_email)

View file

@ -77,7 +77,7 @@ def import_mailman_listinfo(verbosity=0):
to_add = members - known
for addr in to_remove:
note(" Removing subscription: %s" % (addr))
old = Subscribed.objects.get(email=addr)
old = Subscribed.objects.get(email=addr) # Intentionally leaving this as case-sensitive in postgres
old.lists.remove(mmlist)
if old.lists.count() == 0:
note(" Removing address with no subscriptions: %s" % (addr))
@ -90,7 +90,7 @@ def import_mailman_listinfo(verbosity=0):
continue
note(" Adding subscription: %s" % (addr))
try:
new, created = Subscribed.objects.get_or_create(email=addr)
new, created = Subscribed.objects.get_or_create(email=addr) # Intentionally leaving this as case-sensitive in postgres
except MultipleObjectsReturned as e:
sys.stderr.write(" ** Error handling %s in %s: %s\n" % (addr, name, e))
continue