diff options
author | zeripath <art27@cantab.net> | 2022-07-14 08:22:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-14 08:22:09 +0100 |
commit | bffa30302070b594a1c40cdc56264b9731036fb3 (patch) | |
tree | 92104ff6b8a51f5d1506742427dd1399fa42428c /models/user.go | |
parent | 175705356cac06c22d13d86b31605a6ad6dd9642 (diff) | |
download | gitea-bffa30302070b594a1c40cdc56264b9731036fb3.tar.gz gitea-bffa30302070b594a1c40cdc56264b9731036fb3.zip |
Add option to purge users (#18064)
Add the ability to purge users when deleting them.
Close #15588
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'models/user.go')
-rw-r--r-- | models/user.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/models/user.go b/models/user.go index 49374014aa..86a714e746 100644 --- a/models/user.go +++ b/models/user.go @@ -27,7 +27,7 @@ import ( ) // DeleteUser deletes models associated to an user. -func DeleteUser(ctx context.Context, u *user_model.User) (err error) { +func DeleteUser(ctx context.Context, u *user_model.User, purge bool) (err error) { e := db.GetEngine(ctx) // ***** START: Watch ***** @@ -95,8 +95,8 @@ func DeleteUser(ctx context.Context, u *user_model.User) (err error) { return err } - if setting.Service.UserDeleteWithCommentsMaxTime != 0 && - u.CreatedUnix.AsTime().Add(setting.Service.UserDeleteWithCommentsMaxTime).After(time.Now()) { + if purge || (setting.Service.UserDeleteWithCommentsMaxTime != 0 && + u.CreatedUnix.AsTime().Add(setting.Service.UserDeleteWithCommentsMaxTime).After(time.Now())) { // Delete Comments const batchSize = 50 |