]> source.dussan.org Git - gitea.git/commit
Refactor DeleteInactiveUsers, fix bug and add tests (#30206) (#30222)
authorGiteabot <teabot@gitea.io>
Mon, 1 Apr 2024 04:58:46 +0000 (12:58 +0800)
committerGitHub <noreply@github.com>
Mon, 1 Apr 2024 04:58:46 +0000 (12:58 +0800)
commit98a81bef17b7aaa1f88db597f86d1f40cd926566
treed85aeec94a19e52a7104ca50484943a4196ca1eb
parente579ddc31f6d6d0406f1c5330f2a31b9707fb3e2
Refactor DeleteInactiveUsers, fix bug and add tests (#30206) (#30222)

Backport #30206 by wxiaoguang

1. check `IsActive` before calling `IsLastAdminUser`.
2. Fix some comments and error messages.
3. Don't `return err` if "removing file" fails in `DeleteUser`.
4. Remove incorrect `DeleteInactiveEmailAddresses`. Active users could
also have inactive emails, and inactive emails do not support
"olderThan"
5. Add tests

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
models/user/email_address.go
services/user/user.go
services/user/user_test.go