forked from forgejo/forgejo
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>
This commit is contained in:
parent
175705356c
commit
bffa303020
16 changed files with 221 additions and 51 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue