Fix cross conference emailing for registered-by-others users
authorMagnus Hagander <magnus@hagander.net>
Wed, 12 Sep 2018 08:51:49 +0000 (10:51 +0200)
committerMagnus Hagander <magnus@hagander.net>
Wed, 12 Sep 2018 08:51:49 +0000 (10:51 +0200)
When a user is registrered by somebody else, they get an attendee_id of
NULL. These registrations got filtered out against the global opt-out
list, due to the NULL check.

Make it so that any registration with NULL attendee is always included.
If this user decides to opt out globally, the attendee_id field will get
populated when they do that, and the regular opt-out rules will apply.

Per-conference-series optout not affected as it was already doing the
correct thing.

postgresqleu/confreg/views.py

index e64c5b862a5f223a8d543af6e437431806f0d7dd..90070e6816b29b316daf8d6ffaf6f5e88fa51320 100644 (file)
@@ -3057,7 +3057,7 @@ def crossmail(request):
                        q.write("\nUNION ALL\n".join(excs))
                        q.write("\n)\n")
                q.write("SELECT DISTINCT ON (email) email, fullname, token FROM incs\n")
-               q.write(" WHERE userid NOT IN (SELECT user_id FROM confreg_globaloptout)\n")
+               q.write(" WHERE (userid IS NULL OR userid NOT IN (SELECT user_id FROM confreg_globaloptout))\n")
                if excs:
                        q.write(" and email NOT IN (SELECT email FROM excs)\n")
                q.write("ORDER BY email")