Fix scheduled task to delete users with denied applications (#4907)

After an admin interacted with an application it can only be accepted or denied.
Denial reasons are not required by Lemmys backend, even though they're mandatory in Lemmy-UI, and therefore they are not a reliable indicator of an application being denied.
This aligns the cleanup logic  with the logic used for the unread application count.
This commit is contained in:
Richard Schwab 2024-08-14 00:54:56 +02:00 committed by GitHub
parent 254ef6dab3
commit 76a2c6e79b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -115,11 +115,11 @@ impl LocalUser {
let conn = &mut get_conn(pool).await?;
// Make sure:
// - The deny reason exists
// - An admin has interacted with the application
// - The app is older than a week
// - The accepted_application is false
let old_denied_registrations = registration_application::table
.filter(registration_application::deny_reason.is_not_null())
.filter(registration_application::admin_id.is_not_null())
.filter(registration_application::published.lt(now() - 1.week()))
.select(registration_application::local_user_id);