1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-20 16:23:10 +00:00

Use a better OlderThan for DeleteInactiveUsers (#19693)

* Use a better OlderThan for DeleteInactiveUsers

- Currently the OlderThan is zero, for instances that enable or run this
task this could actually delete just new users that still need to
confirm their email. This patch fixes that by setting the default to the
`ActiveCodeLives` setting, which corresponds to the amount of time that
a user can active their account, thus avoiding the issue of deleting
unactivated email users.

* Use correct duration
This commit is contained in:
Gusted 2022-05-13 14:49:22 +02:00 committed by GitHub
parent cafa2dcb87
commit 61f939359d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,7 +26,7 @@ func registerDeleteInactiveUsers() {
RunAtStart: false, RunAtStart: false,
Schedule: "@annually", Schedule: "@annually",
}, },
OlderThan: 0 * time.Second, OlderThan: time.Minute * time.Duration(setting.Service.ActiveCodeLives),
}, func(ctx context.Context, _ *user_model.User, config Config) error { }, func(ctx context.Context, _ *user_model.User, config Config) error {
olderThanConfig := config.(*OlderThanConfig) olderThanConfig := config.(*OlderThanConfig)
return user_service.DeleteInactiveUsers(ctx, olderThanConfig.OlderThan) return user_service.DeleteInactiveUsers(ctx, olderThanConfig.OlderThan)