From 76a2c6e79b19d8bf44a563d492bff8459703596b Mon Sep 17 00:00:00 2001 From: Richard Schwab Date: Wed, 14 Aug 2024 00:54:56 +0200 Subject: [PATCH] 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. --- crates/db_schema/src/impls/local_user.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/db_schema/src/impls/local_user.rs b/crates/db_schema/src/impls/local_user.rs index 32e8d50b7..acff6af2a 100644 --- a/crates/db_schema/src/impls/local_user.rs +++ b/crates/db_schema/src/impls/local_user.rs @@ -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);