[PATCH] cron: fix deletion of unactivated accounts

Stephen Finucane stephen at that.guru
Wed Jul 12 18:39:09 AEST 2017

On Tue, 2017-07-11 at 16:30 +1000, Daniel Axtens wrote:
> There is a test in expire_notifications() that tries to check if
> the user's last login matches the date joined. (I think the login
> date is not set until a post-activation login.) This does not work:
> on patchwork.ozlabs.org there are 10k users that have never been
> deleted.
> Drop the date test: it should be sufficient that a user is not
> active and their confirmation is not pending.
> Reported-by: Stephen Rothwell <sfr at canb.auug.org.au>
> Signed-off-by: Daniel Axtens <dja at axtens.net>

This took me a bit to confirm, as I didn't want to go deleting accounts on a
whim :) So it looks like 'User.is_active' gets set to False initially on
creating an account [1], and is later set to True on account activation [2].
Additionally, the same cron job is responsible for expiring older confirmation
notifications after a set internal. As such, checking if 'User.is_active' is
False and that the User doesn't have any confirmation notifications for it is
what we need, yes.

Reviewed-by: Stephen Finucane <stephen at that.guru>

...and applied.

[1] https://github.com/getpatchwork/patchwork/blob/18a2b98a/patchwork/views/use
[2] https://github.com/getpatchwork/patchwork/blob/18a2b98a/patchwork/views/use
[2] https://github.com/getpatchwork/patchwork/blob/18a2b98a/patchwork/notificat

More information about the Patchwork mailing list