]> git.ipfire.org Git - thirdparty/patchwork.git/commit
notifications: fix notification expiry when no user is associated
authorJeremy Kerr <jk@ozlabs.org>
Tue, 30 Apr 2019 06:03:01 +0000 (16:03 +1000)
committerStephen Finucane <stephen@that.guru>
Tue, 30 Apr 2019 17:36:41 +0000 (11:36 -0600)
commitea9301b76d0fc67b02097cabebd23efbe52300e7
tree2a0b112633c84c8770ba914d3627b36e218a139d
parentca544ba9e19766b1b38089f111e6d0917ceeb2b3
notifications: fix notification expiry when no user is associated

It's possible that an EmailConfirmation object will have no associated
user (eg, for email opt-out, which does not require a user object). In
this case, we will see a NULL value for EmailConfirmation.user_id.

However, having a NULL value appear in a SQL 'IN' clause will match
every value. This means that once one of these null-user
EmailConfirmations is present, we will never expire any non-active user
accounts.

This change adds a filter for a valid user_id when we query for active
EmailConfirmation objects. This means we'll have a valid values set to
use in the pending_confs set.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
[dja: fix pep8 issue]
Signed-off-by: Daniel Axtens <dja@axtens.net>
(cherry picked from commit d0b79d9dee04aee13c8d64a193a7818f72eeca3b)
patchwork/notifications.py